events renaming
[gaemu.git] / gmlparser / tokens.d
blobec121b55261a46160b18b0f2f20f9a4955d1572a
1 /* GML parser
2 * coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
3 * Understanding is not required. Only obedience.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 module gmlparser.tokens;
21 enum Keyword {
22 NoKW,
23 All,
24 And,
25 Break,
26 Case,
27 Continue,
28 Default,
29 Div,
30 Do,
31 Else,
32 Exit,
33 False,
34 For,
35 Function,
36 Global,
37 Globalvar,
38 If,
39 Mod,
40 Noone,
41 Not,
42 Or,
43 Other,
44 Pi,
45 Repeat,
46 Return,
47 Self,
48 Switch,
49 True,
50 Until,
51 Var,
52 While,
53 With,
54 Xor,
55 Add,
56 Sub,
57 Mul,
58 RDiv,
59 BitAnd,
60 BitOr,
61 BitXor,
62 BitNeg,
63 LogAnd,
64 LogOr,
65 LogXor,
66 LogNot,
67 Less,
68 Great,
69 LessEqu,
70 GreatEqu,
71 Equ,
72 NotEqu,
73 Ass,
74 AssAdd,
75 AssSub,
76 AssMul,
77 AssDiv,
78 AssBitAnd,
79 AssBitOr,
80 AssBitXor,
81 AssLShift,
82 AssRShift,
83 Semi,
84 Colon,
85 Comma,
86 Dot,
87 LCurly,
88 RCurly,
89 LParen,
90 RParen,
91 LBracket,
92 RBracket,
93 LShift,
94 RShift,
95 PlusPlus,
96 MinusMinus,
100 __gshared immutable Keyword[string] keywords;
101 __gshared immutable string[int] keywordstx;
104 shared static this () {
105 keywords = [
106 "all": Keyword.All,
107 "and": Keyword.And,
108 "break": Keyword.Break,
109 "case": Keyword.Case,
110 "continue": Keyword.Continue,
111 "default": Keyword.Default,
112 "div": Keyword.Div,
113 "do": Keyword.Do,
114 "else": Keyword.Else,
115 "exit": Keyword.Exit,
116 "false": Keyword.False,
117 "for": Keyword.For,
118 "function": Keyword.Function,
119 "global": Keyword.Global,
120 "globalvar": Keyword.Globalvar,
121 "if": Keyword.If,
122 "mod": Keyword.Mod,
123 "noone": Keyword.Noone,
124 "not": Keyword.Not,
125 "or": Keyword.Or,
126 "other": Keyword.Other,
127 "pi": Keyword.Pi,
128 "repeat": Keyword.Repeat,
129 "return": Keyword.Return,
130 "self": Keyword.Self,
131 "switch": Keyword.Switch,
132 "true": Keyword.True,
133 "until": Keyword.Until,
134 "var": Keyword.Var,
135 "while": Keyword.While,
136 "with": Keyword.With,
137 "xor": Keyword.Xor,
138 "+": Keyword.Add,
139 "-": Keyword.Sub,
140 "*": Keyword.Mul,
141 "/": Keyword.RDiv,
142 "&": Keyword.BitAnd,
143 "|": Keyword.BitOr,
144 "^": Keyword.BitXor,
145 "~": Keyword.BitNeg,
146 "&&": Keyword.LogAnd,
147 "||": Keyword.LogOr,
148 "^^": Keyword.LogXor,
149 "!": Keyword.LogNot,
150 "<": Keyword.Less,
151 ">": Keyword.Great,
152 "<=": Keyword.LessEqu,
153 ">=": Keyword.GreatEqu,
154 "==": Keyword.Equ,
155 "!=": Keyword.NotEqu,
156 "=": Keyword.Ass,
157 "+=": Keyword.AssAdd,
158 "-=": Keyword.AssSub,
159 "*=": Keyword.AssMul,
160 "/=": Keyword.AssDiv,
161 "&=": Keyword.AssBitAnd,
162 "|=": Keyword.AssBitOr,
163 "^=": Keyword.AssBitXor,
164 "<<=": Keyword.AssLShift,
165 ">>=": Keyword.AssRShift,
166 ";": Keyword.Semi,
167 ":": Keyword.Colon,
168 ",": Keyword.Comma,
169 ".": Keyword.Dot,
170 "{": Keyword.LCurly,
171 "}": Keyword.RCurly,
172 "(": Keyword.LParen,
173 ")": Keyword.RParen,
174 "[": Keyword.LBracket,
175 "]": Keyword.RBracket,
176 "<<": Keyword.LShift,
177 ">>": Keyword.RShift,
178 "++": Keyword.PlusPlus,
179 "--": Keyword.MinusMinus,
181 keywordstx = [
182 Keyword.All: "all",
183 Keyword.And: "and",
184 Keyword.Break: "break",
185 Keyword.Case: "case",
186 Keyword.Continue: "continue",
187 Keyword.Default: "default",
188 Keyword.Div: "div",
189 Keyword.Do: "do",
190 Keyword.Else: "else",
191 Keyword.Exit: "exit",
192 Keyword.False: "false",
193 Keyword.For: "for",
194 Keyword.Function: "function",
195 Keyword.Global: "global",
196 Keyword.Globalvar: "globalvar",
197 Keyword.If: "if",
198 Keyword.Mod: "mod",
199 Keyword.Noone: "noone",
200 Keyword.Not: "not",
201 Keyword.Or: "or",
202 Keyword.Other: "other",
203 Keyword.Pi: "pi",
204 Keyword.Repeat: "repeat",
205 Keyword.Return: "return",
206 Keyword.Self: "self",
207 Keyword.Switch: "switch",
208 Keyword.True: "true",
209 Keyword.Until: "until",
210 Keyword.Var: "var",
211 Keyword.While: "while",
212 Keyword.With: "with",
213 Keyword.Xor: "xor",
214 Keyword.Add: "+",
215 Keyword.Sub: "-",
216 Keyword.Mul: "*",
217 Keyword.RDiv: "/",
218 Keyword.BitAnd: "&",
219 Keyword.BitOr: "|",
220 Keyword.BitXor: "^",
221 Keyword.BitNeg: "~",
222 Keyword.LogAnd: "&&",
223 Keyword.LogOr: "||",
224 Keyword.LogXor: "^^",
225 Keyword.LogNot: "!",
226 Keyword.Less: "<",
227 Keyword.Great: ">",
228 Keyword.LessEqu: "<=",
229 Keyword.GreatEqu: ">=",
230 Keyword.Equ: "==",
231 Keyword.NotEqu: "!=",
232 Keyword.Ass: "=",
233 Keyword.AssAdd: "+=",
234 Keyword.AssSub: "-=",
235 Keyword.AssMul: "*=",
236 Keyword.AssDiv: "/=",
237 Keyword.AssBitAnd: "&=",
238 Keyword.AssBitOr: "|=",
239 Keyword.AssBitXor: "^=",
240 Keyword.AssLShift: "<<=",
241 Keyword.AssRShift: ">>=",
242 Keyword.Semi: ";",
243 Keyword.Colon: ":",
244 Keyword.Comma: ",",
245 Keyword.Dot: ".",
246 Keyword.LCurly: "{",
247 Keyword.RCurly: "}",
248 Keyword.LParen: "(",
249 Keyword.RParen: ")",
250 Keyword.LBracket: "[",
251 Keyword.RBracket: "]",
252 Keyword.LShift: "<<",
253 Keyword.RShift: ">>",
254 Keyword.PlusPlus: "++",
255 Keyword.MinusMinus: "--",
260 static string keywordtext (uint id) {
261 if (auto kw = id in keywordstx) return *kw;
262 return "<unknown>";