xfa_fmparse.h revision 4d3acf4ec42bf6e838f9060103aff98fbf170794
1// Copyright 2014 PDFium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7#ifndef XFA_FXFA_FM2JS_XFA_FMPARSE_H_ 8#define XFA_FXFA_FM2JS_XFA_FMPARSE_H_ 9 10#include <memory> 11#include <vector> 12 13#include "xfa/fxfa/fm2js/xfa_expression.h" 14#include "xfa/fxfa/fm2js/xfa_lexer.h" 15 16class CXFA_FMParse { 17 public: 18 CXFA_FMParse(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo); 19 ~CXFA_FMParse(); 20 21 void NextToken(); 22 void Check(XFA_FM_TOKEN op); 23 void Error(uint32_t lineNum, const FX_WCHAR* msg, ...); 24 std::vector<std::unique_ptr<CXFA_FMExpression>> ParseTopExpression(); 25 std::unique_ptr<CXFA_FMExpression> ParseFunction(); 26 std::unique_ptr<CXFA_FMExpression> ParseExpression(); 27 std::unique_ptr<CXFA_FMExpression> ParseVarExpression(); 28 std::unique_ptr<CXFA_FMExpression> ParseExpExpression(); 29 std::unique_ptr<CXFA_FMExpression> ParseBlockExpression(); 30 std::unique_ptr<CXFA_FMExpression> ParseIfExpression(); 31 std::unique_ptr<CXFA_FMExpression> ParseWhileExpression(); 32 std::unique_ptr<CXFA_FMExpression> ParseForExpression(); 33 std::unique_ptr<CXFA_FMExpression> ParseForeachExpression(); 34 std::unique_ptr<CXFA_FMExpression> ParseDoExpression(); 35 std::unique_ptr<CXFA_FMSimpleExpression> ParseParenExpression(); 36 std::unique_ptr<CXFA_FMSimpleExpression> ParseSimpleExpression(); 37 std::unique_ptr<CXFA_FMSimpleExpression> ParseSubassignmentInForExpression(); 38 std::unique_ptr<CXFA_FMSimpleExpression> ParseLogicalOrExpression(); 39 std::unique_ptr<CXFA_FMSimpleExpression> ParseLogicalAndExpression(); 40 std::unique_ptr<CXFA_FMSimpleExpression> ParseEqualityExpression(); 41 std::unique_ptr<CXFA_FMSimpleExpression> ParseRelationalExpression(); 42 std::unique_ptr<CXFA_FMSimpleExpression> ParseAddtiveExpression(); 43 std::unique_ptr<CXFA_FMSimpleExpression> ParseMultiplicativeExpression(); 44 std::unique_ptr<CXFA_FMSimpleExpression> ParseUnaryExpression(); 45 std::unique_ptr<CXFA_FMSimpleExpression> ParsePrimaryExpression(); 46 std::unique_ptr<CXFA_FMSimpleExpression> ParsePostExpression( 47 std::unique_ptr<CXFA_FMSimpleExpression> e); 48 std::unique_ptr<CXFA_FMSimpleExpression> ParseIndexExpression(); 49 50 private: 51 std::unique_ptr<CXFA_FMLexer> m_lexer; 52 CXFA_FMToken* m_pToken; 53 CXFA_FMErrorInfo* const m_pErrorInfo; 54}; 55 56#endif // XFA_FXFA_FM2JS_XFA_FMPARSE_H_ 57