codegen: Fix array size variable on assignment
[vala-lang.git] / vala / valagenietokentype.vala
blobfb8f54f6e1875db1811405e44a53c1897cffaa52
1 /* valagenietokentype.vala
3 * Copyright (C) 2008 Jamie McCracken, Jürg Billeter
4 * Based on code by Jürg Billeter
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.
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.
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
20 * Author:
21 * Jamie McCracken jamiemcc gnome org
24 using GLib;
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 ERRORDOMAIN,
76 EOF,
77 EOL,
78 EVENT,
79 EXCEPT,
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,
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 REAL_LITERAL,
141 READONLY,
142 REF,
143 REGEX_LITERAL,
144 REQUIRES,
145 RETURN,
146 SEMICOLON,
147 SET,
148 SIZEOF,
149 STAR,
150 STATIC,
151 STRING_LITERAL,
152 STRUCT,
153 SUPER,
154 TEMPLATE_STRING_LITERAL,
155 THIS,
156 TILDE,
158 TRUE,
159 TRY,
160 TYPEOF,
161 UNOWNED,
162 USES,
163 VAR,
164 VERBATIM_STRING_LITERAL,
165 VIRTUAL,
166 VOID,
167 VOLATILE,
168 WEAK,
169 WHEN,
170 WHILE,
171 WRITEONLY,
172 YIELD;
174 public unowned string to_string () {
175 switch (this) {
176 case ABSTRACT: return "`abstract'";
177 case ARRAY: return "`array'";
178 case AS: return "`as'";
179 case ASSERT: return "`assert'";
180 case ASSIGN: return "`='";
181 case ASSIGN_ADD: return "`+='";
182 case ASSIGN_BITWISE_AND: return "`&='";
183 case ASSIGN_BITWISE_OR: return "`|='";
184 case ASSIGN_BITWISE_XOR: return "`^='";
185 case ASSIGN_DIV: return "`/='";
186 case ASSIGN_MUL: return "`*='";
187 case ASSIGN_PERCENT: return "`%='";
188 case ASSIGN_SHIFT_LEFT: return "`<<='";
189 case ASSIGN_SUB: return "`-='";
190 case ASYNC: return "`async'";
191 case BITWISE_AND: return "`&'";
192 case BITWISE_OR: return "`|'";
193 case BREAK: return "`break'";
194 case CARRET: return "`^'";
195 case CASE: return "`case'";
196 case CHARACTER_LITERAL: return "character literal";
197 case CLASS: return "`class'";
198 case CLOSE_BRACE: return "`}'";
199 case CLOSE_BRACKET: return "`]'";
200 case CLOSE_PARENS: return "`)'";
201 case CLOSE_REGEX_LITERAL: return "`/'";
202 case COLON: return "`:'";
203 case COMMA: return "`,'";
204 case CONST: return "`const'";
205 case CONSTRUCT: return "`construct'";
206 case CONTINUE: return "`continue'";
207 case DEDENT: return "`dedent'";
208 case DEF: return "`def'";
209 case DEFAULT: return "`default'";
210 case DELEGATE: return "`delegate'";
211 case DELETE: return "`delete'";
212 case DICT: return "`dict'";
213 case DIV: return "`/'";
214 case DO: return "`do'";
215 case DOT: return "`.'";
216 case DOWNTO: return "`downto'";
217 case DYNAMIC: return "`dynamic'";
218 case ELLIPSIS: return "`...'";
219 case ELSE: return "`else'";
220 case ENUM: return "`enum'";
221 case ENSURES: return "`ensures'";
222 case ERRORDOMAIN: return "`errordomain'";
223 case EOF: return "end of file";
224 case EOL: return "end of line";
225 case EVENT: return "event";
226 case EXCEPT: return "`except'";
227 case EXTERN: return "`extern'";
228 case FALSE: return "`false'";
229 case FINAL: return "`final'";
230 case FINALLY: return "`finally'";
231 case FOR: return "`for'";
232 case GET: return "`get'";
233 case HASH: return "`hash'";
234 case IDENTIFIER: return "identifier";
235 case IF: return "`if'";
236 case IMPLEMENTS: return "`implements'";
237 case IN: return "`in'";
238 case INDENT: return "`tab indent'";
239 case INIT: return "`init'";
240 case INLINE: return "`inline'";
241 case INTEGER_LITERAL: return "integer literal";
242 case INTERFACE: return "`interface'";
243 case INTERNAL: return "`internal'";
244 case INTERR: return "`?'";
245 case IS: return "`is'";
246 case ISA: return "`isa'";
247 case LAMBDA: return "`=>'";
248 case LIST: return "`list'";
249 case LOCK: return "`lock'";
250 case MINUS: return "`-'";
251 case NAMESPACE: return "`namespace'";
252 case NEW: return "`new'";
253 case NULL: return "`null'";
254 case OF: return "`of'";
255 case OUT: return "`out'";
256 case OP_AND: return "`&&'";
257 case OP_DEC: return "`--'";
258 case OP_EQ: return "`=='";
259 case OP_GE: return "`>='";
260 case OP_GT: return "`>'";
261 case OP_INC: return "`++'";
262 case OP_LE: return "`<='";
263 case OP_LT: return "`<'";
264 case OP_NE: return "`!='";
265 case OP_NEG: return "`!'";
266 case OP_OR: return "`||'";
267 case OP_PTR: return "`->'";
268 case OP_SHIFT_LEFT: return "`<<'";
269 case OPEN_BRACE: return "`{'";
270 case OPEN_BRACKET: return "`['";
271 case OPEN_PARENS: return "`('";
272 case OPEN_REGEX_LITERAL: return "`/'";
273 case OVERRIDE: return "`override'";
274 case OWNED: return "`owned'";
275 case PARAMS: return "`params'";
276 case PASS: return "`pass'";
277 case PERCENT: return "`%'";
278 case PLUS: return "`+'";
279 case PRINT: return "`print'";
280 case PRIVATE: return "`private'";
281 case PROP: return "`prop'";
282 case PROTECTED: return "`protected'";
283 case PUBLIC: return "`public'";
284 case RAISE: return "`raise'";
285 case RAISES: return "`raises'";
286 case READONLY: return "`readonly'";
287 case REAL_LITERAL: return "real literal";
288 case REF: return "`ref'";
289 case REGEX_LITERAL: return "regex literal";
290 case REQUIRES: return "`requires'";
291 case RETURN: return "`return'";
292 case SEMICOLON: return "`;'";
293 case SET: return "`set'";
294 case SIZEOF: return "`sizeof'";
295 case STAR: return "`*'";
296 case STATIC: return "`static'";
297 case STRING_LITERAL: return "string literal";
298 case STRUCT: return "`struct'";
299 case SUPER: return "`super'";
300 case THIS: return "`self'";
301 case TILDE: return "`~'";
302 case TO: return "`to'";
303 case TRUE: return "`true'";
304 case TRY: return "`try'";
305 case TYPEOF: return "`typeof'";
306 case UNOWNED: return "`unowned'";
307 case USES: return "`uses'";
308 case VAR: return "`var'";
309 case VIRTUAL: return "`virtual'";
310 case VOID: return "`void'";
311 case VOLATILE: return "`volatile'";
312 case WEAK: return "`weak'";
313 case WHEN: return "`when'";
314 case WHILE: return "`while'";
315 case WRITEONLY: return "`writeonly'";
316 case YIELD: return "`yield'";
317 default: return "unknown token";