1
2
3
4 #include <soulng/spg/ParserFileTokens.hpp>
5 #include <map>
6
7 namespace ParserFileTokens
8 {
9 std::map<std::u32string, int> tokenIdMap;
10
11 void InitTokenIdMap()
12 {
13 tokenIdMap[U"AMP"] = 75;
14 tokenIdMap[U"AMPAMP"] = 70;
15 tokenIdMap[U"ANDASSIGN"] = 115;
16 tokenIdMap[U"ANY"] = 8;
17 tokenIdMap[U"API"] = 2;
18 tokenIdMap[U"ARROW"] = 91;
19 tokenIdMap[U"ARROWSTAR"] = 72;
20 tokenIdMap[U"ASSIGN"] = 107;
21 tokenIdMap[U"AUTO"] = 15;
22 tokenIdMap[U"BITOR"] = 73;
23 tokenIdMap[U"BITXOR"] = 74;
24 tokenIdMap[U"BOOL"] = 22;
25 tokenIdMap[U"BREAK"] = 58;
26 tokenIdMap[U"CASE"] = 50;
27 tokenIdMap[U"CATCH"] = 63;
28 tokenIdMap[U"CHAR"] = 20;
29 tokenIdMap[U"CHARLIT"] = 67;
30 tokenIdMap[U"COLON"] = 103;
31 tokenIdMap[U"COLONCOLON"] = 102;
32 tokenIdMap[U"COMMA"] = 106;
33 tokenIdMap[U"CONST"] = 32;
34 tokenIdMap[U"CONSTCAST"] = 42;
35 tokenIdMap[U"CONTINUE"] = 59;
36 tokenIdMap[U"CPL"] = 89;
37 tokenIdMap[U"CPPPREFIX"] = 10;
38 tokenIdMap[U"DEFAULT"] = 51;
39 tokenIdMap[U"DELETE"] = 46;
40 tokenIdMap[U"DISJUNCTION"] = 69;
41 tokenIdMap[U"DIV"] = 85;
42 tokenIdMap[U"DIVASSIGN"] = 109;
43 tokenIdMap[U"DO"] = 56;
44 tokenIdMap[U"DOT"] = 90;
45 tokenIdMap[U"DOTSTAR"] = 71;
46 tokenIdMap[U"DOUBLE"] = 29;
47 tokenIdMap[U"DYNAMICCAST"] = 39;
48 tokenIdMap[U"ELLIPSIS"] = 101;
49 tokenIdMap[U"ELSE"] = 53;
50 tokenIdMap[U"EMPTY"] = 7;
51 tokenIdMap[U"EQ"] = 76;
52 tokenIdMap[U"EXCLAMATION"] = 14;
53 tokenIdMap[U"EXTERN"] = 18;
54 tokenIdMap[U"FALSE"] = 48;
55 tokenIdMap[U"FILEPATH"] = 12;
56 tokenIdMap[U"FLOAT"] = 28;
57 tokenIdMap[U"FLOATINGLIT"] = 66;
58 tokenIdMap[U"FOR"] = 57;
59 tokenIdMap[U"GEQ"] = 79;
60 tokenIdMap[U"GOTO"] = 61;
61 tokenIdMap[U"HASH"] = 105;
62 tokenIdMap[U"HPPPREFIX"] = 11;
63 tokenIdMap[U"ID"] = 64;
64 tokenIdMap[U"IF"] = 52;
65 tokenIdMap[U"INCLUDE"] = 3;
66 tokenIdMap[U"INT"] = 24;
67 tokenIdMap[U"INTLIT"] = 65;
68 tokenIdMap[U"LANGLE"] = 99;
69 tokenIdMap[U"LBRACE"] = 95;
70 tokenIdMap[U"LBRACKET"] = 97;
71 tokenIdMap[U"LEQ"] = 78;
72 tokenIdMap[U"LONG"] = 25;
73 tokenIdMap[U"LPAREN"] = 93;
74 tokenIdMap[U"MAIN"] = 4;
75 tokenIdMap[U"MINUS"] = 83;
76 tokenIdMap[U"MINUSASSIGN"] = 112;
77 tokenIdMap[U"MINUSMINUS"] = 88;
78 tokenIdMap[U"MULASSIGN"] = 108;
79 tokenIdMap[U"MUTABLE"] = 19;
80 tokenIdMap[U"NAMESPACE"] = 35;
81 tokenIdMap[U"NEQ"] = 77;
82 tokenIdMap[U"NEW"] = 45;
83 tokenIdMap[U"NULLPTR"] = 49;
84 tokenIdMap[U"OPERATOR"] = 38;
85 tokenIdMap[U"ORASSIGN"] = 117;
86 tokenIdMap[U"PARSER"] = 1;
87 tokenIdMap[U"PLUS"] = 82;
88 tokenIdMap[U"PLUSASSIGN"] = 111;
89 tokenIdMap[U"PLUSPLUS"] = 87;
90 tokenIdMap[U"PRODUCES"] = 13;
91 tokenIdMap[U"QUEST"] = 92;
92 tokenIdMap[U"RANGLE"] = 100;
93 tokenIdMap[U"RBRACE"] = 96;
94 tokenIdMap[U"RBRACKET"] = 98;
95 tokenIdMap[U"REGISTER"] = 16;
96 tokenIdMap[U"REINTERPRETCAST"] = 41;
97 tokenIdMap[U"REM"] = 86;
98 tokenIdMap[U"REMASSIGN"] = 110;
99 tokenIdMap[U"RETURN"] = 60;
100 tokenIdMap[U"RPAREN"] = 94;
101 tokenIdMap[U"RULEINFO"] = 6;
102 tokenIdMap[U"SEMICOLON"] = 104;
103 tokenIdMap[U"SHIFTLEFT"] = 80;
104 tokenIdMap[U"SHIFTLEFTASSIGN"] = 113;
105 tokenIdMap[U"SHIFTRIGHT"] = 81;
106 tokenIdMap[U"SHIFTRIGHTASSIGN"] = 114;
107 tokenIdMap[U"SHORT"] = 23;
108 tokenIdMap[U"SIGNED"] = 26;
109 tokenIdMap[U"SIZEOF"] = 37;
110 tokenIdMap[U"STAR"] = 84;
111 tokenIdMap[U"STATIC"] = 17;
112 tokenIdMap[U"STATICCAST"] = 40;
113 tokenIdMap[U"STRINGLIT"] = 68;
114 tokenIdMap[U"SWITCH"] = 54;
115 tokenIdMap[U"THIS"] = 44;
116 tokenIdMap[U"THROW"] = 36;
117 tokenIdMap[U"TRUE"] = 47;
118 tokenIdMap[U"TRY"] = 62;
119 tokenIdMap[U"TYPEDEF"] = 31;
120 tokenIdMap[U"TYPEID"] = 43;
121 tokenIdMap[U"UNSIGNED"] = 27;
122 tokenIdMap[U"USELEXER"] = 5;
123 tokenIdMap[U"USING"] = 34;
124 tokenIdMap[U"VAR"] = 9;
125 tokenIdMap[U"VOID"] = 30;
126 tokenIdMap[U"VOLATILE"] = 33;
127 tokenIdMap[U"WCHART"] = 21;
128 tokenIdMap[U"WHILE"] = 55;
129 tokenIdMap[U"XORASSIGN"] = 116;
130 }
131
132 int GetTokenId(const std::u32string& tokenName)
133 {
134 auto it = tokenIdMap.find(tokenName);
135 if (it != tokenIdMap.cend())
136 {
137 return it->second;
138 }
139 else
140 {
141 return -1;
142 }
143 }
144
145 const char* tokenName[] =
146 {
147 "END",
148 "PARSER",
149 "API",
150 "INCLUDE",
151 "MAIN",
152 "USELEXER",
153 "RULEINFO",
154 "EMPTY",
155 "ANY",
156 "VAR",
157 "CPPPREFIX",
158 "HPPPREFIX",
159 "FILEPATH",
160 "PRODUCES",
161 "EXCLAMATION",
162 "AUTO",
163 "REGISTER",
164 "STATIC",
165 "EXTERN",
166 "MUTABLE",
167 "CHAR",
168 "WCHART",
169 "BOOL",
170 "SHORT",
171 "INT",
172 "LONG",
173 "SIGNED",
174 "UNSIGNED",
175 "FLOAT",
176 "DOUBLE",
177 "VOID",
178 "TYPEDEF",
179 "CONST",
180 "VOLATILE",
181 "USING",
182 "NAMESPACE",
183 "THROW",
184 "SIZEOF",
185 "OPERATOR",
186 "DYNAMICCAST",
187 "STATICCAST",
188 "REINTERPRETCAST",
189 "CONSTCAST",
190 "TYPEID",
191 "THIS",
192 "NEW",
193 "DELETE",
194 "TRUE",
195 "FALSE",
196 "NULLPTR",
197 "CASE",
198 "DEFAULT",
199 "IF",
200 "ELSE",
201 "SWITCH",
202 "WHILE",
203 "DO",
204 "FOR",
205 "BREAK",
206 "CONTINUE",
207 "RETURN",
208 "GOTO",
209 "TRY",
210 "CATCH",
211 "ID",
212 "INTLIT",
213 "FLOATINGLIT",
214 "CHARLIT",
215 "STRINGLIT",
216 "DISJUNCTION",
217 "AMPAMP",
218 "DOTSTAR",
219 "ARROWSTAR",
220 "BITOR",
221 "BITXOR",
222 "AMP",
223 "EQ",
224 "NEQ",
225 "LEQ",
226 "GEQ",
227 "SHIFTLEFT",
228 "SHIFTRIGHT",
229 "PLUS",
230 "MINUS",
231 "STAR",
232 "DIV",
233 "REM",
234 "PLUSPLUS",
235 "MINUSMINUS",
236 "CPL",
237 "DOT",
238 "ARROW",
239 "QUEST",
240 "LPAREN",
241 "RPAREN",
242 "LBRACE",
243 "RBRACE",
244 "LBRACKET",
245 "RBRACKET",
246 "LANGLE",
247 "RANGLE",
248 "ELLIPSIS",
249 "COLONCOLON",
250 "COLON",
251 "SEMICOLON",
252 "HASH",
253 "COMMA",
254 "ASSIGN",
255 "MULASSIGN",
256 "DIVASSIGN",
257 "REMASSIGN",
258 "PLUSASSIGN",
259 "MINUSASSIGN",
260 "SHIFTLEFTASSIGN",
261 "SHIFTRIGHTASSIGN",
262 "ANDASSIGN",
263 "XORASSIGN",
264 "ORASSIGN"
265 };
266
267 const char* GetTokenName(int tokenId)
268 {
269 return tokenName[tokenId];
270 }
271
272 const char* tokenInfo[] =
273 {
274 "end of file",
275 "'parser'",
276 "'api'",
277 "'include'",
278 "'main'",
279 "'uselexer'",
280 "'ruleinfo'",
281 "'empty'",
282 "'any'",
283 "'var'",
284 "cpp-prefix",
285 "hpp-prefix",
286 "file path",
287 "'::='",
288 "'!'",
289 "'auto'",
290 "'register'",
291 "'static'",
292 "'extern'",
293 "'mutable'",
294 "'char'",
295 "'wchar_t'",
296 "'bool'",
297 "'short'",
298 "'int'",
299 "'long'",
300 "'signed'",
301 "'unsigned'",
302 "'float'",
303 "'double'",
304 "'void'",
305 "'typedef'",
306 "'const'",
307 "'volatile'",
308 "'using'",
309 "'namespace'",
310 "'throw'",
311 "'sizeof'",
312 "'operator'",
313 "'dynamic_cast'",
314 "'static_cast'",
315 "'reinterpret_cast'",
316 "'const_cast'",
317 "'typeid'",
318 "'this'",
319 "'new'",
320 "'delete'",
321 "'true'",
322 "'false'",
323 "'nullptr'",
324 "'case'",
325 "'default'",
326 "'if'",
327 "'else'",
328 "'switch'",
329 "'while'",
330 "'do'",
331 "'for'",
332 "'break'",
333 "'continue'",
334 "'return'",
335 "'goto'",
336 "'try'",
337 "'catch'",
338 "identifier",
339 "integer literal",
340 "floating literal",
341 "character literal",
342 "string literal",
343 "'||'",
344 "'&&'",
345 "'.*'",
346 "'->*'",
347 "'|'",
348 "'^'",
349 "'&'",
350 "'=='",
351 "'!='",
352 "'<='",
353 "'>='",
354 "'<<'",
355 "'>>'",
356 "'+'",
357 "'-'",
358 "'*'",
359 "'/'",
360 "'%'",
361 "'++'",
362 "'--'",
363 "'~'",
364 "'.'",
365 "'->'",
366 "'?'",
367 "'('",
368 "')'",
369 "'{'",
370 "'}'",
371 "'['",
372 "']'",
373 "'<'",
374 "'>'",
375 "'...'",
376 "'::'",
377 "':'",
378 "';'",
379 "'#'",
380 "','",
381 "'='",
382 "'*='",
383 "'/='",
384 "'%='",
385 "'+='",
386 "'-='",
387 "'<<='",
388 "'>>='",
389 "'&='",
390 "'^='",
391 "'|='"
392 };
393
394 const char* GetTokenInfo(int tokenId)
395 {
396 return tokenInfo[tokenId];
397 }
398
399 struct Initializer
400 {
401 Initializer() { InitTokenIdMap(); }
402 };
403
404 Initializer initializer;
405 }