OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXFA_FM2JS_XFA_LEXER_H_ | 7 #ifndef XFA_FXFA_FM2JS_XFA_LEXER_H_ |
8 #define XFA_FXFA_FM2JS_XFA_LEXER_H_ | 8 #define XFA_FXFA_FM2JS_XFA_LEXER_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 explicit CXFA_FMToken(uint32_t uLineNum); | 97 explicit CXFA_FMToken(uint32_t uLineNum); |
98 | 98 |
99 CFX_WideStringC m_wstring; | 99 CFX_WideStringC m_wstring; |
100 XFA_FM_TOKEN m_type; | 100 XFA_FM_TOKEN m_type; |
101 uint32_t m_uLinenum; | 101 uint32_t m_uLinenum; |
102 }; | 102 }; |
103 | 103 |
104 class CXFA_FMLexer { | 104 class CXFA_FMLexer { |
105 public: | 105 public: |
106 CXFA_FMLexer(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo); | 106 CXFA_FMLexer(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo); |
| 107 ~CXFA_FMLexer(); |
| 108 |
107 CXFA_FMToken* NextToken(); | 109 CXFA_FMToken* NextToken(); |
108 uint32_t Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); | 110 uint32_t Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); |
109 uint32_t String(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); | 111 uint32_t String(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); |
110 uint32_t Identifiers(CXFA_FMToken* t, | 112 uint32_t Identifiers(CXFA_FMToken* t, |
111 const FX_WCHAR* p, | 113 const FX_WCHAR* p, |
112 const FX_WCHAR*& pEnd); | 114 const FX_WCHAR*& pEnd); |
113 void Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd); | 115 void Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd); |
114 XFA_FM_TOKEN IsKeyword(const CFX_WideStringC& p); | 116 XFA_FM_TOKEN IsKeyword(const CFX_WideStringC& p); |
115 void SetCurrentLine(uint32_t line) { m_uCurrentLine = line; } | 117 void SetCurrentLine(uint32_t line) { m_uCurrentLine = line; } |
116 void SetToken(CXFA_FMToken* pToken) { | 118 void SetToken(CXFA_FMToken* pToken) { |
117 if (m_pToken.get() != pToken) | 119 if (m_pToken.get() != pToken) |
118 m_pToken.reset(pToken); | 120 m_pToken.reset(pToken); |
119 } | 121 } |
120 const FX_WCHAR* SavePos() { return m_ptr; } | 122 const FX_WCHAR* SavePos() { return m_ptr; } |
121 void RestorePos(const FX_WCHAR* pPos) { m_ptr = pPos; } | 123 void RestorePos(const FX_WCHAR* pPos) { m_ptr = pPos; } |
122 void Error(const FX_WCHAR* msg, ...); | 124 void Error(const FX_WCHAR* msg, ...); |
123 FX_BOOL HasError() const; | 125 FX_BOOL HasError() const; |
124 | 126 |
125 protected: | 127 protected: |
126 CXFA_FMToken* Scan(); | 128 CXFA_FMToken* Scan(); |
127 | 129 |
128 const FX_WCHAR* m_ptr; | 130 const FX_WCHAR* m_ptr; |
129 uint32_t m_uCurrentLine; | 131 uint32_t m_uCurrentLine; |
130 std::unique_ptr<CXFA_FMToken> m_pToken; | 132 std::unique_ptr<CXFA_FMToken> m_pToken; |
131 CXFA_FMErrorInfo* m_pErrorInfo; | 133 CXFA_FMErrorInfo* m_pErrorInfo; |
132 }; | 134 }; |
133 | 135 |
134 #endif // XFA_FXFA_FM2JS_XFA_LEXER_H_ | 136 #endif // XFA_FXFA_FM2JS_XFA_LEXER_H_ |
OLD | NEW |