1 
 2 // this file has been automatically generated from 'D:/work/soulng-project/tools/sng2html/sng2html/RegExLexer.lexer' using soulng lexer generator slg version 3.0.0
 3 
 4 #include <sng2html/sng2html/RegExTokens.hpp>
 5 #include <map>
 6 
 7 namespace RegExTokens
 8 {
 9     std::map<std::u32string, int> tokenIdMap;
10 
11     void InitTokenIdMap()
12     {
13         tokenIdMap[U"ALT"] = 7;
14         tokenIdMap[U"CHAR"] = 15;
15         tokenIdMap[U"DOT"] = 11;
16         tokenIdMap[U"ESCAPE"] = 12;
17         tokenIdMap[U"INVERSE"] = 13;
18         tokenIdMap[U"LBRACE"] = 5;
19         tokenIdMap[U"LBRACKET"] = 3;
20         tokenIdMap[U"LPAREN"] = 1;
21         tokenIdMap[U"MINUS"] = 14;
22         tokenIdMap[U"PLUS"] = 9;
23         tokenIdMap[U"QUEST"] = 10;
24         tokenIdMap[U"RBRACE"] = 6;
25         tokenIdMap[U"RBRACKET"] = 4;
26         tokenIdMap[U"RPAREN"] = 2;
27         tokenIdMap[U"STAR"] = 8;
28     }
29 
30     int GetTokenId(const std::u32string& tokenName)
31     {
32         auto it = tokenIdMap.find(tokenName);
33         if (it != tokenIdMap.cend())
34         {
35             return it->second;
36         }
37         else
38         {
39             return -1;
40         }
41     }
42 
43     const char* tokenName[] =
44     {
45         "END", 
46         "LPAREN", 
47         "RPAREN", 
48         "LBRACKET", 
49         "RBRACKET", 
50         "LBRACE", 
51         "RBRACE", 
52         "ALT", 
53         "STAR", 
54         "PLUS", 
55         "QUEST", 
56         "DOT", 
57         "ESCAPE", 
58         "INVERSE", 
59         "MINUS", 
60         "CHAR"
61     };
62 
63     const char* GetTokenName(int tokenId)
64     {
65         return tokenName[tokenId];
66     }
67 
68     const char* tokenInfo[] =
69     {
70         "end of file", 
71         "'('", 
72         "')'", 
73         "'['", 
74         "']'", 
75         "'{'", 
76         "'}", 
77         "'|'", 
78         "'*'", 
79         "'+'", 
80         "'?'", 
81         "'.'", 
82         "escape", 
83         "'^'", 
84         "'-'", 
85         "character"
86     };
87 
88     const char* GetTokenInfo(int tokenId)
89     {
90         return tokenInfo[tokenId];
91     }
92 
93     struct Initializer 
94     {
95         Initializer() { InitTokenIdMap(); }
96     };
97 
98     Initializer initializer;
99 }