1
2
3
4 #include <sngcm/cmlexer/TokenLexerTokens.hpp>
5 #include <map>
6
7 namespace TokenLexerTokens
8 {
9 std::map<std::u32string, int> tokenIdMap;
10
11 void InitTokenIdMap()
12 {
13 tokenIdMap[U"ABSTRACT"] = 40;
14 tokenIdMap[U"AMP"] = 90;
15 tokenIdMap[U"AMPAMP"] = 87;
16 tokenIdMap[U"AND"] = 76;
17 tokenIdMap[U"ARROW"] = 106;
18 tokenIdMap[U"AS"] = 28;
19 tokenIdMap[U"ASSERT"] = 1;
20 tokenIdMap[U"ASSIGN"] = 116;
21 tokenIdMap[U"AXIOM"] = 75;
22 tokenIdMap[U"BASE"] = 64;
23 tokenIdMap[U"BITOR"] = 88;
24 tokenIdMap[U"BITXOR"] = 89;
25 tokenIdMap[U"BLOCKCOMMENT"] = 122;
26 tokenIdMap[U"BLOCKCOMMENTLINE"] = 123;
27 tokenIdMap[U"BOOL"] = 4;
28 tokenIdMap[U"BREAK"] = 54;
29 tokenIdMap[U"BYTE"] = 8;
30 tokenIdMap[U"CASE"] = 49;
31 tokenIdMap[U"CAST"] = 22;
32 tokenIdMap[U"CATCH"] = 71;
33 tokenIdMap[U"CDECL"] = 33;
34 tokenIdMap[U"CHAR"] = 17;
35 tokenIdMap[U"CHARLIT"] = 82;
36 tokenIdMap[U"CLASS"] = 44;
37 tokenIdMap[U"COLON"] = 117;
38 tokenIdMap[U"COMMA"] = 115;
39 tokenIdMap[U"CONCEPT"] = 73;
40 tokenIdMap[U"CONST"] = 60;
41 tokenIdMap[U"CONSTEXPR"] = 61;
42 tokenIdMap[U"CONSTRUCT"] = 65;
43 tokenIdMap[U"CONTINUE"] = 55;
44 tokenIdMap[U"CPL"] = 104;
45 tokenIdMap[U"DEFAULT"] = 50;
46 tokenIdMap[U"DELEGATE"] = 31;
47 tokenIdMap[U"DELETE"] = 68;
48 tokenIdMap[U"DESTROY"] = 66;
49 tokenIdMap[U"DISJUNCTION"] = 86;
50 tokenIdMap[U"DIV"] = 100;
51 tokenIdMap[U"DO"] = 52;
52 tokenIdMap[U"DOT"] = 105;
53 tokenIdMap[U"DOUBLE"] = 16;
54 tokenIdMap[U"ELIF"] = 2;
55 tokenIdMap[U"ELSE"] = 47;
56 tokenIdMap[U"ENDIF"] = 3;
57 tokenIdMap[U"ENUM"] = 21;
58 tokenIdMap[U"EQ"] = 91;
59 tokenIdMap[U"EQUIVALENCE"] = 84;
60 tokenIdMap[U"EXCLAMATION"] = 78;
61 tokenIdMap[U"EXPLICIT"] = 30;
62 tokenIdMap[U"EXTERN"] = 27;
63 tokenIdMap[U"FALSE"] = 6;
64 tokenIdMap[U"FLOAT"] = 15;
65 tokenIdMap[U"FLOATINGLIT"] = 80;
66 tokenIdMap[U"FOR"] = 53;
67 tokenIdMap[U"GEQ"] = 94;
68 tokenIdMap[U"GOTO"] = 56;
69 tokenIdMap[U"HASH"] = 119;
70 tokenIdMap[U"ID"] = 125;
71 tokenIdMap[U"IF"] = 46;
72 tokenIdMap[U"IMPLICATION"] = 85;
73 tokenIdMap[U"INLINE"] = 32;
74 tokenIdMap[U"INT"] = 11;
75 tokenIdMap[U"INTERFACE"] = 23;
76 tokenIdMap[U"INTERNAL"] = 38;
77 tokenIdMap[U"INTLIT"] = 81;
78 tokenIdMap[U"IS"] = 29;
79 tokenIdMap[U"KEYWORD"] = 124;
80 tokenIdMap[U"LANGLE"] = 111;
81 tokenIdMap[U"LBRACE"] = 113;
82 tokenIdMap[U"LBRACKET"] = 107;
83 tokenIdMap[U"LEQ"] = 93;
84 tokenIdMap[U"LINECOMMENT"] = 121;
85 tokenIdMap[U"LONG"] = 13;
86 tokenIdMap[U"LPAREN"] = 109;
87 tokenIdMap[U"MAX"] = 128;
88 tokenIdMap[U"MINUS"] = 98;
89 tokenIdMap[U"MINUSMINUS"] = 103;
90 tokenIdMap[U"NAMESPACE"] = 24;
91 tokenIdMap[U"NEQ"] = 92;
92 tokenIdMap[U"NEW"] = 67;
93 tokenIdMap[U"NOTHROW"] = 34;
94 tokenIdMap[U"NULLLIT"] = 62;
95 tokenIdMap[U"NUMBER"] = 126;
96 tokenIdMap[U"OPERATOR"] = 43;
97 tokenIdMap[U"OR"] = 77;
98 tokenIdMap[U"OTHER"] = 127;
99 tokenIdMap[U"OVERRIDE"] = 41;
100 tokenIdMap[U"PLUS"] = 97;
101 tokenIdMap[U"PLUSPLUS"] = 102;
102 tokenIdMap[U"PRIVATE"] = 37;
103 tokenIdMap[U"PROTECTED"] = 36;
104 tokenIdMap[U"PUBLIC"] = 35;
105 tokenIdMap[U"RANGLE"] = 112;
106 tokenIdMap[U"RBRACE"] = 114;
107 tokenIdMap[U"RBRACKET"] = 108;
108 tokenIdMap[U"REM"] = 101;
109 tokenIdMap[U"RETURN"] = 45;
110 tokenIdMap[U"RPAREN"] = 110;
111 tokenIdMap[U"SBYTE"] = 7;
112 tokenIdMap[U"SEMICOLON"] = 118;
113 tokenIdMap[U"SHIFTLEFT"] = 95;
114 tokenIdMap[U"SHIFTRIGHT"] = 96;
115 tokenIdMap[U"SHORT"] = 9;
116 tokenIdMap[U"SIZEOF"] = 69;
117 tokenIdMap[U"STAR"] = 99;
118 tokenIdMap[U"STATIC"] = 26;
119 tokenIdMap[U"STRINGLIT"] = 83;
120 tokenIdMap[U"SUPPRESS"] = 42;
121 tokenIdMap[U"SWITCH"] = 48;
122 tokenIdMap[U"THIS"] = 63;
123 tokenIdMap[U"THROW"] = 72;
124 tokenIdMap[U"TRUE"] = 5;
125 tokenIdMap[U"TRY"] = 70;
126 tokenIdMap[U"TYPEDEF"] = 57;
127 tokenIdMap[U"TYPEID"] = 59;
128 tokenIdMap[U"TYPENAME"] = 58;
129 tokenIdMap[U"UCHAR"] = 19;
130 tokenIdMap[U"UINT"] = 12;
131 tokenIdMap[U"ULONG"] = 14;
132 tokenIdMap[U"UNIT_TEST"] = 79;
133 tokenIdMap[U"USHORT"] = 10;
134 tokenIdMap[U"USING"] = 25;
135 tokenIdMap[U"VIRTUAL"] = 39;
136 tokenIdMap[U"VOID"] = 20;
137 tokenIdMap[U"WCHAR"] = 18;
138 tokenIdMap[U"WHERE"] = 74;
139 tokenIdMap[U"WHILE"] = 51;
140 tokenIdMap[U"WS"] = 120;
141 }
142
143 int GetTokenId(const std::u32string& tokenName)
144 {
145 auto it = tokenIdMap.find(tokenName);
146 if (it != tokenIdMap.cend())
147 {
148 return it->second;
149 }
150 else
151 {
152 return -1;
153 }
154 }
155
156 const char* tokenName[] =
157 {
158 "END",
159 "ASSERT",
160 "ELIF",
161 "ENDIF",
162 "BOOL",
163 "TRUE",
164 "FALSE",
165 "SBYTE",
166 "BYTE",
167 "SHORT",
168 "USHORT",
169 "INT",
170 "UINT",
171 "LONG",
172 "ULONG",
173 "FLOAT",
174 "DOUBLE",
175 "CHAR",
176 "WCHAR",
177 "UCHAR",
178 "VOID",
179 "ENUM",
180 "CAST",
181 "INTERFACE",
182 "NAMESPACE",
183 "USING",
184 "STATIC",
185 "EXTERN",
186 "AS",
187 "IS",
188 "EXPLICIT",
189 "DELEGATE",
190 "INLINE",
191 "CDECL",
192 "NOTHROW",
193 "PUBLIC",
194 "PROTECTED",
195 "PRIVATE",
196 "INTERNAL",
197 "VIRTUAL",
198 "ABSTRACT",
199 "OVERRIDE",
200 "SUPPRESS",
201 "OPERATOR",
202 "CLASS",
203 "RETURN",
204 "IF",
205 "ELSE",
206 "SWITCH",
207 "CASE",
208 "DEFAULT",
209 "WHILE",
210 "DO",
211 "FOR",
212 "BREAK",
213 "CONTINUE",
214 "GOTO",
215 "TYPEDEF",
216 "TYPENAME",
217 "TYPEID",
218 "CONST",
219 "CONSTEXPR",
220 "NULLLIT",
221 "THIS",
222 "BASE",
223 "CONSTRUCT",
224 "DESTROY",
225 "NEW",
226 "DELETE",
227 "SIZEOF",
228 "TRY",
229 "CATCH",
230 "THROW",
231 "CONCEPT",
232 "WHERE",
233 "AXIOM",
234 "AND",
235 "OR",
236 "EXCLAMATION",
237 "UNIT_TEST",
238 "FLOATINGLIT",
239 "INTLIT",
240 "CHARLIT",
241 "STRINGLIT",
242 "EQUIVALENCE",
243 "IMPLICATION",
244 "DISJUNCTION",
245 "AMPAMP",
246 "BITOR",
247 "BITXOR",
248 "AMP",
249 "EQ",
250 "NEQ",
251 "LEQ",
252 "GEQ",
253 "SHIFTLEFT",
254 "SHIFTRIGHT",
255 "PLUS",
256 "MINUS",
257 "STAR",
258 "DIV",
259 "REM",
260 "PLUSPLUS",
261 "MINUSMINUS",
262 "CPL",
263 "DOT",
264 "ARROW",
265 "LBRACKET",
266 "RBRACKET",
267 "LPAREN",
268 "RPAREN",
269 "LANGLE",
270 "RANGLE",
271 "LBRACE",
272 "RBRACE",
273 "COMMA",
274 "ASSIGN",
275 "COLON",
276 "SEMICOLON",
277 "HASH",
278 "WS",
279 "LINECOMMENT",
280 "BLOCKCOMMENT",
281 "BLOCKCOMMENTLINE",
282 "KEYWORD",
283 "ID",
284 "NUMBER",
285 "OTHER",
286 "MAX"
287 };
288
289 const char* GetTokenName(int tokenId)
290 {
291 return tokenName[tokenId];
292 }
293
294 const char* tokenInfo[] =
295 {
296 "end of file",
297 "'assert'",
298 "'elif'",
299 "'endif'",
300 "'bool'",
301 "'true'",
302 "'false'",
303 "'sbyte'",
304 "'byte'",
305 "'short'",
306 "'ushort'",
307 "'int'",
308 "'uint'",
309 "'long'",
310 "'ulong'",
311 "'float'",
312 "'double'",
313 "'char'",
314 "'wchar'",
315 "'uchar'",
316 "'void'",
317 "'enum'",
318 "'cast'",
319 "'interface'",
320 "'namespace'",
321 "'using'",
322 "'static'",
323 "'extern'",
324 "'as'",
325 "'is'",
326 "'explicit'",
327 "'delegate'",
328 "'inline'",
329 "'cdecl'",
330 "'nothrow'",
331 "'public'",
332 "'protected'",
333 "'private'",
334 "'internal'",
335 "'virtual'",
336 "'abstract'",
337 "'override'",
338 "'suppress'",
339 "'operator'",
340 "'class'",
341 "'return'",
342 "'if'",
343 "'else'",
344 "'switch'",
345 "'case'",
346 "'default'",
347 "'while'",
348 "'do'",
349 "'for'",
350 "'break'",
351 "'continue'",
352 "'goto'",
353 "'typedef'",
354 "'typename'",
355 "'typeid'",
356 "'const'",
357 "'constexpr'",
358 "'null'",
359 "'this'",
360 "'base'",
361 "'construct'",
362 "'destroy'",
363 "'new'",
364 "'delete'",
365 "'sizeof'",
366 "'try'",
367 "'catch'",
368 "'throw'",
369 "'concept'",
370 "'where'",
371 "'axiom'",
372 "'and'",
373 "'or'",
374 "'!'",
375 "'unit_test'",
376 "floating literal",
377 "integer literal",
378 "character literal",
379 "string literal",
380 "'<=>'",
381 "'=>'",
382 "'||'",
383 "'&&'",
384 "'|'",
385 "'^'",
386 "'&'",
387 "'=='",
388 "'!='",
389 "'<='",
390 "'>='",
391 "'<<'",
392 "'>>'",
393 "'+'",
394 "'-'",
395 "'*'",
396 "'/'",
397 "'%'",
398 "'++'",
399 "'--'",
400 "'~'",
401 "'.'",
402 "'->'",
403 "'['",
404 "']'",
405 "'('",
406 "')'",
407 "'<'",
408 "'>'",
409 "'{'",
410 "'}'",
411 "','",
412 "'='",
413 "':'",
414 "';'",
415 "'#'",
416 "white space",
417 "line comment",
418 "block comment",
419 "block comment line",
420 "keyword",
421 "identifier",
422 "number",
423 "other",
424 "max"
425 };
426
427 const char* GetTokenInfo(int tokenId)
428 {
429 return tokenInfo[tokenId];
430 }
431
432 struct Initializer
433 {
434 Initializer() { InitTokenIdMap(); }
435 };
436
437 Initializer initializer;
438 }