| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 XFA_FM_TOKEN m_type; | 87 XFA_FM_TOKEN m_type; |
| 88 uint32_t m_uHash; | 88 uint32_t m_uHash; |
| 89 const FX_WCHAR* m_keyword; | 89 const FX_WCHAR* m_keyword; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op); | 92 const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op); |
| 93 | 93 |
| 94 class CXFA_FMToken { | 94 class CXFA_FMToken { |
| 95 public: | 95 public: |
| 96 CXFA_FMToken(); | 96 CXFA_FMToken(); |
| 97 explicit CXFA_FMToken(FX_DWORD 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 FX_DWORD 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_FMToken* NextToken(); | 107 CXFA_FMToken* NextToken(); |
| 108 FX_DWORD Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); | 108 uint32_t Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); |
| 109 FX_DWORD String(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); |
| 110 FX_DWORD Identifiers(CXFA_FMToken* t, | 110 uint32_t Identifiers(CXFA_FMToken* t, |
| 111 const FX_WCHAR* p, | 111 const FX_WCHAR* p, |
| 112 const FX_WCHAR*& pEnd); | 112 const FX_WCHAR*& pEnd); |
| 113 void Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd); | 113 void Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd); |
| 114 XFA_FM_TOKEN IsKeyword(const CFX_WideStringC& p); | 114 XFA_FM_TOKEN IsKeyword(const CFX_WideStringC& p); |
| 115 void SetCurrentLine(FX_DWORD line) { m_uCurrentLine = line; } | 115 void SetCurrentLine(uint32_t line) { m_uCurrentLine = line; } |
| 116 void SetToken(CXFA_FMToken* pToken) { | 116 void SetToken(CXFA_FMToken* pToken) { |
| 117 if (m_pToken.get() != pToken) | 117 if (m_pToken.get() != pToken) |
| 118 m_pToken.reset(pToken); | 118 m_pToken.reset(pToken); |
| 119 } | 119 } |
| 120 const FX_WCHAR* SavePos() { return m_ptr; } | 120 const FX_WCHAR* SavePos() { return m_ptr; } |
| 121 void RestorePos(const FX_WCHAR* pPos) { m_ptr = pPos; } | 121 void RestorePos(const FX_WCHAR* pPos) { m_ptr = pPos; } |
| 122 void Error(XFA_FM_ERRMSG msg, ...); | 122 void Error(XFA_FM_ERRMSG msg, ...); |
| 123 FX_BOOL HasError() const; | 123 FX_BOOL HasError() const; |
| 124 | 124 |
| 125 protected: | 125 protected: |
| 126 CXFA_FMToken* Scan(); | 126 CXFA_FMToken* Scan(); |
| 127 | 127 |
| 128 const FX_WCHAR* m_ptr; | 128 const FX_WCHAR* m_ptr; |
| 129 FX_DWORD m_uCurrentLine; | 129 uint32_t m_uCurrentLine; |
| 130 std::unique_ptr<CXFA_FMToken> m_pToken; | 130 std::unique_ptr<CXFA_FMToken> m_pToken; |
| 131 CXFA_FMErrorInfo* m_pErrorInfo; | 131 CXFA_FMErrorInfo* m_pErrorInfo; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 #endif // XFA_FXFA_FM2JS_XFA_LEXER_H_ | 134 #endif // XFA_FXFA_FM2JS_XFA_LEXER_H_ |
| OLD | NEW |