1
2
3
4 #include <cmajor/build/BuildLangTokens.hpp>
5 #include <map>
6
7 namespace BuildLangTokens
8 {
9 std::map<std::u32string, int> tokenIdMap;
10
11 void InitTokenIdMap()
12 {
13 tokenIdMap[U"ADD"] = 1;
14 tokenIdMap[U"ALL"] = 29;
15 tokenIdMap[U"BUILD"] = 13;
16 tokenIdMap[U"CLANG"] = 9;
17 tokenIdMap[U"CONFIG"] = 31;
18 tokenIdMap[U"CONFIGURATION"] = 6;
19 tokenIdMap[U"DEBUG"] = 15;
20 tokenIdMap[U"DEFAULT"] = 7;
21 tokenIdMap[U"DOT"] = 35;
22 tokenIdMap[U"EQ"] = 34;
23 tokenIdMap[U"FILEPATH"] = 23;
24 tokenIdMap[U"FORCE"] = 27;
25 tokenIdMap[U"FROM"] = 19;
26 tokenIdMap[U"GCC"] = 10;
27 tokenIdMap[U"HOST"] = 4;
28 tokenIdMap[U"ID"] = 22;
29 tokenIdMap[U"INSTALL"] = 17;
30 tokenIdMap[U"INTEGER"] = 24;
31 tokenIdMap[U"LBRACKET"] = 32;
32 tokenIdMap[U"MESSAGES"] = 26;
33 tokenIdMap[U"ONLY"] = 28;
34 tokenIdMap[U"PORT"] = 5;
35 tokenIdMap[U"PUSH"] = 12;
36 tokenIdMap[U"RBRACKET"] = 33;
37 tokenIdMap[U"REBUILD"] = 30;
38 tokenIdMap[U"RELEASE"] = 16;
39 tokenIdMap[U"REMOVE"] = 2;
40 tokenIdMap[U"RUN"] = 3;
41 tokenIdMap[U"SERVER"] = 21;
42 tokenIdMap[U"SHOW"] = 14;
43 tokenIdMap[U"TO"] = 18;
44 tokenIdMap[U"TOOLCHAIN"] = 8;
45 tokenIdMap[U"USING"] = 20;
46 tokenIdMap[U"VERBOSE"] = 25;
47 tokenIdMap[U"VS"] = 11;
48 }
49
50 int GetTokenId(const std::u32string& tokenName)
51 {
52 auto it = tokenIdMap.find(tokenName);
53 if (it != tokenIdMap.cend())
54 {
55 return it->second;
56 }
57 else
58 {
59 return -1;
60 }
61 }
62
63 const char* tokenName[] =
64 {
65 "END",
66 "ADD",
67 "REMOVE",
68 "RUN",
69 "HOST",
70 "PORT",
71 "CONFIGURATION",
72 "DEFAULT",
73 "TOOLCHAIN",
74 "CLANG",
75 "GCC",
76 "VS",
77 "PUSH",
78 "BUILD",
79 "SHOW",
80 "DEBUG",
81 "RELEASE",
82 "INSTALL",
83 "TO",
84 "FROM",
85 "USING",
86 "SERVER",
87 "ID",
88 "FILEPATH",
89 "INTEGER",
90 "VERBOSE",
91 "MESSAGES",
92 "FORCE",
93 "ONLY",
94 "ALL",
95 "REBUILD",
96 "CONFIG",
97 "LBRACKET",
98 "RBRACKET",
99 "EQ",
100 "DOT"
101 };
102
103 const char* GetTokenName(int tokenId)
104 {
105 return tokenName[tokenId];
106 }
107
108 const char* tokenInfo[] =
109 {
110 "end of file",
111 "'add'",
112 "'remove'",
113 "'run'",
114 "'host'",
115 "'port'",
116 "'configuration'",
117 "'default'",
118 "'toolchain'",
119 "'clang'",
120 "'gcc'",
121 "'vs'",
122 "'push'",
123 "'build'",
124 "'show'",
125 "'debug'",
126 "'release'",
127 "'install'",
128 "'to'",
129 "'from'",
130 "'using'",
131 "'server'",
132 "'id'",
133 "'filepath'",
134 "'integer'",
135 "'verbose'",
136 "'messages'",
137 "'force'",
138 "'only",
139 "'all'",
140 "'rebuild'",
141 "'config'",
142 "'['",
143 "']'",
144 "'='",
145 "'.'"
146 };
147
148 const char* GetTokenInfo(int tokenId)
149 {
150 return tokenInfo[tokenId];
151 }
152
153 struct Initializer
154 {
155 Initializer() { InitTokenIdMap(); }
156 };
157
158 Initializer initializer;
159 }