Line data Source code
1 : /* valagenietokentype.vala
2 : *
3 : * Copyright (C) 2008-2012 Jamie McCracken, Jürg Billeter
4 : * Based on code by Jürg Billeter
5 : *
6 : * This library is free software; you can redistribute it and/or
7 : * modify it under the terms of the GNU Lesser General Public
8 : * License as published by the Free Software Foundation; either
9 : * version 2.1 of the License, or (at your option) any later version.
10 :
11 : * This library is distributed in the hope that it will be useful,
12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 : * Lesser General Public License for more details.
15 :
16 : * You should have received a copy of the GNU Lesser General Public
17 : * License along with this library; if not, write to the Free Software
18 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 : *
20 : * Author:
21 : * Jamie McCracken jamiemcc gnome org
22 : */
23 :
24 : using GLib;
25 :
26 : public enum Vala.Genie.TokenType {
27 : NONE,
28 : ABSTRACT,
29 : ARRAY,
30 : AS,
31 : ASSERT,
32 : ASSIGN,
33 : ASSIGN_ADD,
34 : ASSIGN_BITWISE_AND,
35 : ASSIGN_BITWISE_OR,
36 : ASSIGN_BITWISE_XOR,
37 : ASSIGN_DIV,
38 : ASSIGN_MUL,
39 : ASSIGN_PERCENT,
40 : ASSIGN_SHIFT_LEFT,
41 : ASSIGN_SUB,
42 : ASYNC,
43 : BITWISE_AND,
44 : BITWISE_OR,
45 : BREAK,
46 : CARRET,
47 : CASE,
48 : CHARACTER_LITERAL,
49 : CLASS,
50 : CLOSE_BRACE,
51 : CLOSE_BRACKET,
52 : CLOSE_PARENS,
53 : CLOSE_REGEX_LITERAL,
54 : CLOSE_TEMPLATE,
55 : COLON,
56 : COMMA,
57 : CONST,
58 : CONSTRUCT,
59 : CONTINUE,
60 : DEDENT,
61 : DEF,
62 : DEFAULT,
63 : DELEGATE,
64 : DELETE,
65 : DICT,
66 : DIV,
67 : DO,
68 : DOT,
69 : DOWNTO,
70 : DYNAMIC,
71 : ELLIPSIS,
72 : ELSE,
73 : ENUM,
74 : ENSURES,
75 : EOF,
76 : EOL,
77 : EVENT,
78 : EXCEPT,
79 : EXCEPTION,
80 : EXTERN,
81 : FALSE,
82 : FINAL,
83 : FINALLY,
84 : FOR,
85 : GET,
86 : HASH,
87 : IDENTIFIER,
88 : IF,
89 : IMPLEMENTS,
90 : IN,
91 : INDENT,
92 : INIT,
93 : INLINE,
94 : INTEGER_LITERAL,
95 : INTERFACE,
96 : INTERNAL,
97 : INTERR,
98 : IS,
99 : ISA,
100 : LAMBDA,
101 : LIST,
102 : LOCK,
103 : MINUS,
104 : NAMESPACE,
105 : NEW,
106 : NULL,
107 : OF,
108 : OUT,
109 : OP_AND,
110 : OP_DEC,
111 : OP_EQ,
112 : OP_GE,
113 : OP_GT,
114 : OP_INC,
115 : OP_LE,
116 : OP_LT,
117 : OP_NE,
118 : OP_NEG,
119 : OP_OR,
120 : OP_PTR,
121 : OP_SHIFT_LEFT,
122 : OPEN_BRACE,
123 : OPEN_BRACKET,
124 : OPEN_PARENS,
125 : OPEN_REGEX_LITERAL,
126 : OPEN_TEMPLATE,
127 : OVERRIDE,
128 : OWNED,
129 : PARAMS,
130 : PASS,
131 : PERCENT,
132 : PLUS,
133 : PRINT,
134 : PRIVATE,
135 : PROP,
136 : PROTECTED,
137 : PUBLIC,
138 : RAISE,
139 : RAISES,
140 : READONLY,
141 : REAL_LITERAL,
142 : REF,
143 : REGEX_LITERAL,
144 : REQUIRES,
145 : RETURN,
146 : SEALED,
147 : SELF,
148 : SEMICOLON,
149 : SET,
150 : SIZEOF,
151 : STAR,
152 : STATIC,
153 : STRING_LITERAL,
154 : STRUCT,
155 : SUPER,
156 : TEMPLATE_STRING_LITERAL,
157 : TILDE,
158 : TO,
159 : TRUE,
160 : TRY,
161 : TYPEOF,
162 : UNOWNED,
163 : USES,
164 : VAR,
165 : VERBATIM_STRING_LITERAL,
166 : VERBATIM_TEMPLATE_STRING_LITERAL,
167 : VIRTUAL,
168 : VOID,
169 : VOLATILE,
170 : WEAK,
171 : WHEN,
172 : WHILE,
173 : YIELD;
174 :
175 : public unowned string to_string () {
176 0 : switch (this) {
177 0 : case ABSTRACT: return "`abstract'";
178 0 : case ARRAY: return "`array'";
179 0 : case AS: return "`as'";
180 0 : case ASSERT: return "`assert'";
181 0 : case ASSIGN: return "`='";
182 0 : case ASSIGN_ADD: return "`+='";
183 0 : case ASSIGN_BITWISE_AND: return "`&='";
184 0 : case ASSIGN_BITWISE_OR: return "`|='";
185 0 : case ASSIGN_BITWISE_XOR: return "`^='";
186 0 : case ASSIGN_DIV: return "`/='";
187 0 : case ASSIGN_MUL: return "`*='";
188 0 : case ASSIGN_PERCENT: return "`%='";
189 0 : case ASSIGN_SHIFT_LEFT: return "`<<='";
190 0 : case ASSIGN_SUB: return "`-='";
191 0 : case ASYNC: return "`async'";
192 0 : case BITWISE_AND: return "`&'";
193 0 : case BITWISE_OR: return "`|'";
194 0 : case BREAK: return "`break'";
195 0 : case CARRET: return "`^'";
196 0 : case CASE: return "`case'";
197 0 : case CHARACTER_LITERAL: return "character literal";
198 0 : case CLASS: return "`class'";
199 0 : case CLOSE_BRACE: return "`}'";
200 0 : case CLOSE_BRACKET: return "`]'";
201 0 : case CLOSE_PARENS: return "`)'";
202 0 : case CLOSE_REGEX_LITERAL: return "`/'";
203 0 : case CLOSE_TEMPLATE: return "close template";
204 0 : case COLON: return "`:'";
205 0 : case COMMA: return "`,'";
206 0 : case CONST: return "`const'";
207 0 : case CONSTRUCT: return "`construct'";
208 0 : case CONTINUE: return "`continue'";
209 0 : case DEDENT: return "end of block (dedent)";
210 0 : case DEF: return "`def'";
211 0 : case DEFAULT: return "`default'";
212 0 : case DELEGATE: return "`delegate'";
213 0 : case DELETE: return "`delete'";
214 0 : case DICT: return "`dict'";
215 0 : case DIV: return "`/'";
216 0 : case DO: return "`do'";
217 0 : case DOT: return "`.'";
218 0 : case DOWNTO: return "`downto'";
219 0 : case DYNAMIC: return "`dynamic'";
220 0 : case ELLIPSIS: return "`...'";
221 0 : case ELSE: return "`else'";
222 0 : case ENUM: return "`enum'";
223 0 : case ENSURES: return "`ensures'";
224 0 : case EOF: return "end of file";
225 0 : case EOL: return "end of line";
226 0 : case EVENT: return "event";
227 0 : case EXCEPT: return "`except'";
228 0 : case EXCEPTION: return "`exception'";
229 0 : case EXTERN: return "`extern'";
230 0 : case FALSE: return "`false'";
231 0 : case FINAL: return "`final'";
232 0 : case FINALLY: return "`finally'";
233 0 : case FOR: return "`for'";
234 0 : case GET: return "`get'";
235 0 : case HASH: return "`#'";
236 0 : case IDENTIFIER: return "identifier";
237 0 : case IF: return "`if'";
238 0 : case IMPLEMENTS: return "`implements'";
239 0 : case IN: return "`in'";
240 0 : case INDENT: return "block (indent)";
241 0 : case INIT: return "`init'";
242 0 : case INLINE: return "`inline'";
243 0 : case INTEGER_LITERAL: return "integer literal";
244 0 : case INTERFACE: return "`interface'";
245 0 : case INTERNAL: return "`internal'";
246 0 : case INTERR: return "`?'";
247 0 : case IS: return "`is'";
248 0 : case ISA: return "`isa'";
249 0 : case LAMBDA: return "`=>'";
250 0 : case LIST: return "`list'";
251 0 : case LOCK: return "`lock'";
252 0 : case MINUS: return "`-'";
253 0 : case NAMESPACE: return "`namespace'";
254 0 : case NEW: return "`new'";
255 0 : case NULL: return "`null'";
256 0 : case OF: return "`of'";
257 0 : case OUT: return "`out'";
258 0 : case OP_AND: return "`and'";
259 0 : case OP_DEC: return "`--'";
260 0 : case OP_EQ: return "`=='";
261 0 : case OP_GE: return "`>='";
262 0 : case OP_GT: return "`>'";
263 0 : case OP_INC: return "`++'";
264 0 : case OP_LE: return "`<='";
265 0 : case OP_LT: return "`<'";
266 0 : case OP_NE: return "`!='";
267 0 : case OP_NEG: return "`!'";
268 0 : case OP_OR: return "`or'";
269 0 : case OP_PTR: return "`->'";
270 0 : case OP_SHIFT_LEFT: return "`<<'";
271 0 : case OPEN_BRACE: return "`{'";
272 0 : case OPEN_BRACKET: return "`['";
273 0 : case OPEN_PARENS: return "`('";
274 0 : case OPEN_REGEX_LITERAL: return "`/'";
275 0 : case OPEN_TEMPLATE: return "open template";
276 0 : case OVERRIDE: return "`override'";
277 0 : case OWNED: return "`owned'";
278 0 : case PARAMS: return "`params'";
279 0 : case PASS: return "`pass'";
280 0 : case PERCENT: return "`%'";
281 0 : case PLUS: return "`+'";
282 0 : case PRINT: return "`print'";
283 0 : case PRIVATE: return "`private'";
284 0 : case PROP: return "`prop'";
285 0 : case PROTECTED: return "`protected'";
286 0 : case PUBLIC: return "`public'";
287 0 : case RAISE: return "`raise'";
288 0 : case RAISES: return "`raises'";
289 0 : case READONLY: return "`readonly'";
290 0 : case REAL_LITERAL: return "real literal";
291 0 : case REF: return "`ref'";
292 0 : case REGEX_LITERAL: return "regex literal";
293 0 : case REQUIRES: return "`requires'";
294 0 : case RETURN: return "`return'";
295 0 : case SEALED: return "`sealed'";
296 0 : case SELF: return "`self'";
297 0 : case SEMICOLON: return "`;'";
298 0 : case SET: return "`set'";
299 0 : case SIZEOF: return "`sizeof'";
300 0 : case STAR: return "`*'";
301 0 : case STATIC: return "`static'";
302 0 : case STRING_LITERAL: return "string literal";
303 0 : case STRUCT: return "`struct'";
304 0 : case SUPER: return "`super'";
305 0 : case TEMPLATE_STRING_LITERAL: return "template string literal";
306 0 : case TILDE: return "`~'";
307 0 : case TO: return "`to'";
308 0 : case TRUE: return "`true'";
309 0 : case TRY: return "`try'";
310 0 : case TYPEOF: return "`typeof'";
311 0 : case UNOWNED: return "`unowned'";
312 0 : case USES: return "`uses'";
313 0 : case VAR: return "`var'";
314 0 : case VERBATIM_STRING_LITERAL: return "verbatim string literal";
315 0 : case VERBATIM_TEMPLATE_STRING_LITERAL: return "verbatim template string literal";
316 0 : case VIRTUAL: return "`virtual'";
317 0 : case VOID: return "`void'";
318 0 : case VOLATILE: return "`volatile'";
319 0 : case WEAK: return "`weak'";
320 0 : case WHEN: return "`when'";
321 0 : case WHILE: return "`while'";
322 0 : case YIELD: return "`yield'";
323 0 : default: return "unknown token";
324 : }
325 : }
326 : }
327 :
|