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, version 3 of the License ONLY.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 module gaem
.parser
.tokens
;
99 __gshared
immutable Keyword
[string
] keywords
;
100 __gshared
immutable string
[int] keywordstx
;
103 shared static this () {
107 "break": Keyword
.Break
,
108 "case": Keyword
.Case
,
109 "continue": Keyword
.Continue
,
110 "default": Keyword
.Default
,
113 "else": Keyword
.Else
,
114 "exit": Keyword
.Exit
,
115 "false": Keyword
.False
,
117 "function": Keyword
.Function
,
118 "global": Keyword
.Global
,
119 "globalvar": Keyword
.Globalvar
,
122 "noone": Keyword
.Noone
,
125 "other": Keyword
.Other
,
127 "repeat": Keyword
.Repeat
,
128 "return": Keyword
.Return
,
129 "self": Keyword
.Self
,
130 "switch": Keyword
.Switch
,
131 "true": Keyword
.True
,
132 "until": Keyword
.Until
,
134 "while": Keyword
.While
,
135 "with": Keyword
.With
,
145 "&&": Keyword
.LogAnd
,
147 "^^": Keyword
.LogXor
,
151 "<=": Keyword
.LessEqu
,
152 ">=": Keyword
.GreatEqu
,
154 "!=": Keyword
.NotEqu
,
156 "+=": Keyword
.AssAdd
,
157 "-=": Keyword
.AssSub
,
158 "*=": Keyword
.AssMul
,
159 "/=": Keyword
.AssDiv
,
160 "&=": Keyword
.AssBitAnd
,
161 "|=": Keyword
.AssBitOr
,
162 "^=": Keyword
.AssBitXor
,
163 "<<=": Keyword
.AssLShift
,
164 ">>=": Keyword
.AssRShift
,
173 "[": Keyword
.LBracket
,
174 "]": Keyword
.RBracket
,
175 "<<": Keyword
.LShift
,
176 ">>": Keyword
.RShift
,
177 "++": Keyword
.PlusPlus
,
178 "--": Keyword
.MinusMinus
,
183 Keyword
.Break
: "break",
184 Keyword
.Case
: "case",
185 Keyword
.Continue
: "continue",
186 Keyword
.Default
: "default",
189 Keyword
.Else
: "else",
190 Keyword
.Exit
: "exit",
191 Keyword
.False
: "false",
193 Keyword
.Function
: "function",
194 Keyword
.Global
: "global",
195 Keyword
.Globalvar
: "globalvar",
198 Keyword
.Noone
: "noone",
201 Keyword
.Other
: "other",
203 Keyword
.Repeat
: "repeat",
204 Keyword
.Return
: "return",
205 Keyword
.Self
: "self",
206 Keyword
.Switch
: "switch",
207 Keyword
.True
: "true",
208 Keyword
.Until
: "until",
210 Keyword
.While
: "while",
211 Keyword
.With
: "with",
221 Keyword
.LogAnd
: "&&",
223 Keyword
.LogXor
: "^^",
227 Keyword
.LessEqu
: "<=",
228 Keyword
.GreatEqu
: ">=",
230 Keyword
.NotEqu
: "!=",
232 Keyword
.AssAdd
: "+=",
233 Keyword
.AssSub
: "-=",
234 Keyword
.AssMul
: "*=",
235 Keyword
.AssDiv
: "/=",
236 Keyword
.AssBitAnd
: "&=",
237 Keyword
.AssBitOr
: "|=",
238 Keyword
.AssBitXor
: "^=",
239 Keyword
.AssLShift
: "<<=",
240 Keyword
.AssRShift
: ">>=",
249 Keyword
.LBracket
: "[",
250 Keyword
.RBracket
: "]",
251 Keyword
.LShift
: "<<",
252 Keyword
.RShift
: ">>",
253 Keyword
.PlusPlus
: "++",
254 Keyword
.MinusMinus
: "--",
259 static string
keywordtext (uint id
) {
260 if (auto kw
= id
in keywordstx
) return *kw
;