Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Side by Side Diff: xfa/src/fxfa/fm2js/xfa_lexer.h

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/src/fxfa/fm2js/xfa_fmparse.cpp ('k') | xfa/src/fxfa/fm2js/xfa_lexer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_SRC_FXFA_FM2JS_XFA_LEXER_H_
8 #define XFA_SRC_FXFA_FM2JS_XFA_LEXER_H_
9
10 #include <memory>
11
12 #include "core/include/fxcrt/fx_string.h"
13 #include "xfa/src/fxfa/fm2js/xfa_error.h"
14
15 enum XFA_FM_TOKEN {
16 TOKand,
17 TOKlparen,
18 TOKrparen,
19 TOKmul,
20 TOKplus,
21 TOKcomma,
22 TOKminus,
23 TOKdot,
24 TOKdiv,
25 TOKlt,
26 TOKassign,
27 TOKgt,
28 TOKlbracket,
29 TOKrbracket,
30 TOKor,
31 TOKdotscream,
32 TOKdotstar,
33 TOKdotdot,
34 TOKle,
35 TOKne,
36 TOKeq,
37 TOKge,
38 TOKdo,
39 TOKkseq,
40 TOKksge,
41 TOKksgt,
42 TOKif,
43 TOKin,
44 TOKksle,
45 TOKkslt,
46 TOKksne,
47 TOKksor,
48 TOKnull,
49 TOKbreak,
50 TOKksand,
51 TOKend,
52 TOKeof,
53 TOKfor,
54 TOKnan,
55 TOKksnot,
56 TOKvar,
57 TOKthen,
58 TOKelse,
59 TOKexit,
60 TOKdownto,
61 TOKreturn,
62 TOKinfinity,
63 TOKendwhile,
64 TOKforeach,
65 TOKendfunc,
66 TOKelseif,
67 TOKwhile,
68 TOKendfor,
69 TOKthrow,
70 TOKstep,
71 TOKupto,
72 TOKcontinue,
73 TOKfunc,
74 TOKendif,
75 TOKstar,
76 TOKidentifier,
77 TOKunderscore,
78 TOKdollar,
79 TOKexclamation,
80 TOKcall,
81 TOKstring,
82 TOKnumber,
83 TOKreserver
84 };
85
86 struct XFA_FMKeyword {
87 XFA_FM_TOKEN m_type;
88 uint32_t m_uHash;
89 const FX_WCHAR* m_keyword;
90 };
91
92 const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op);
93
94 class CXFA_FMToken {
95 public:
96 CXFA_FMToken();
97 explicit CXFA_FMToken(FX_DWORD uLineNum);
98
99 CFX_WideStringC m_wstring;
100 XFA_FM_TOKEN m_type;
101 FX_DWORD m_uLinenum;
102 };
103
104 class CXFA_FMLexer {
105 public:
106 CXFA_FMLexer(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo);
107 CXFA_FMToken* NextToken();
108 FX_DWORD 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);
110 FX_DWORD Identifiers(CXFA_FMToken* t,
111 const FX_WCHAR* p,
112 const FX_WCHAR*& pEnd);
113 void Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd);
114 XFA_FM_TOKEN IsKeyword(const CFX_WideStringC& p);
115 void SetCurrentLine(FX_DWORD line) { m_uCurrentLine = line; }
116 void SetToken(CXFA_FMToken* pToken) {
117 if (m_pToken.get() != pToken)
118 m_pToken.reset(pToken);
119 }
120 const FX_WCHAR* SavePos() { return m_ptr; }
121 void RestorePos(const FX_WCHAR* pPos) { m_ptr = pPos; }
122 void Error(XFA_FM_ERRMSG msg, ...);
123 FX_BOOL HasError() const;
124
125 protected:
126 CXFA_FMToken* Scan();
127
128 const FX_WCHAR* m_ptr;
129 FX_DWORD m_uCurrentLine;
130 std::unique_ptr<CXFA_FMToken> m_pToken;
131 CXFA_FMErrorInfo* m_pErrorInfo;
132 };
133
134 #endif // XFA_SRC_FXFA_FM2JS_XFA_LEXER_H_
OLDNEW
« no previous file with comments | « xfa/src/fxfa/fm2js/xfa_fmparse.cpp ('k') | xfa/src/fxfa/fm2js/xfa_lexer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698