Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: frog/token_kind.g.dart

Issue 10548047: Remove frog from the repository. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move test and update apidoc.gyp. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/token.dart ('k') | frog/tokenizer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 // Generated by scripts/token_kind_gen.py.
5
6 class TokenKind {
7 /** [TokenKind] representing end of file tokens. */
8 static final int END_OF_FILE = 1;
9
10 /** [TokenKind] representing ( tokens. */
11 static final int LPAREN = 2;
12
13 /** [TokenKind] representing ) tokens. */
14 static final int RPAREN = 3;
15
16 /** [TokenKind] representing [ tokens. */
17 static final int LBRACK = 4;
18
19 /** [TokenKind] representing ] tokens. */
20 static final int RBRACK = 5;
21
22 /** [TokenKind] representing { tokens. */
23 static final int LBRACE = 6;
24
25 /** [TokenKind] representing } tokens. */
26 static final int RBRACE = 7;
27
28 /** [TokenKind] representing : tokens. */
29 static final int COLON = 8;
30
31 /** [TokenKind] representing => tokens. */
32 static final int ARROW = 9;
33
34 /** [TokenKind] representing ; tokens. */
35 static final int SEMICOLON = 10;
36
37 /** [TokenKind] representing , tokens. */
38 static final int COMMA = 11;
39
40 /** [TokenKind] representing # tokens. */
41 static final int HASH = 12;
42
43 /** [TokenKind] representing #! tokens. */
44 static final int HASHBANG = 13;
45
46 /** [TokenKind] representing . tokens. */
47 static final int DOT = 14;
48
49 /** [TokenKind] representing ... tokens. */
50 static final int ELLIPSIS = 15;
51
52 /** [TokenKind] representing ++ tokens. */
53 static final int INCR = 16;
54
55 /** [TokenKind] representing -- tokens. */
56 static final int DECR = 17;
57
58 /** [TokenKind] representing ~ tokens. */
59 static final int BIT_NOT = 18;
60
61 /** [TokenKind] representing ! tokens. */
62 static final int NOT = 19;
63
64 /** [TokenKind] representing = tokens. */
65 static final int ASSIGN = 20;
66
67 /** [TokenKind] representing |= tokens. */
68 static final int ASSIGN_OR = 21;
69
70 /** [TokenKind] representing ^= tokens. */
71 static final int ASSIGN_XOR = 22;
72
73 /** [TokenKind] representing &= tokens. */
74 static final int ASSIGN_AND = 23;
75
76 /** [TokenKind] representing <<= tokens. */
77 static final int ASSIGN_SHL = 24;
78
79 /** [TokenKind] representing >>= tokens. */
80 static final int ASSIGN_SAR = 25;
81
82 /** [TokenKind] representing >>>= tokens. */
83 static final int ASSIGN_SHR = 26;
84
85 /** [TokenKind] representing += tokens. */
86 static final int ASSIGN_ADD = 27;
87
88 /** [TokenKind] representing -= tokens. */
89 static final int ASSIGN_SUB = 28;
90
91 /** [TokenKind] representing *= tokens. */
92 static final int ASSIGN_MUL = 29;
93
94 /** [TokenKind] representing /= tokens. */
95 static final int ASSIGN_DIV = 30;
96
97 /** [TokenKind] representing ~/= tokens. */
98 static final int ASSIGN_TRUNCDIV = 31;
99
100 /** [TokenKind] representing %= tokens. */
101 static final int ASSIGN_MOD = 32;
102
103 /** [TokenKind] representing ? tokens. */
104 static final int CONDITIONAL = 33;
105
106 /** [TokenKind] representing || tokens. */
107 static final int OR = 34;
108
109 /** [TokenKind] representing && tokens. */
110 static final int AND = 35;
111
112 /** [TokenKind] representing | tokens. */
113 static final int BIT_OR = 36;
114
115 /** [TokenKind] representing ^ tokens. */
116 static final int BIT_XOR = 37;
117
118 /** [TokenKind] representing & tokens. */
119 static final int BIT_AND = 38;
120
121 /** [TokenKind] representing << tokens. */
122 static final int SHL = 39;
123
124 /** [TokenKind] representing >> tokens. */
125 static final int SAR = 40;
126
127 /** [TokenKind] representing >>> tokens. */
128 static final int SHR = 41;
129
130 /** [TokenKind] representing + tokens. */
131 static final int ADD = 42;
132
133 /** [TokenKind] representing - tokens. */
134 static final int SUB = 43;
135
136 /** [TokenKind] representing * tokens. */
137 static final int MUL = 44;
138
139 /** [TokenKind] representing / tokens. */
140 static final int DIV = 45;
141
142 /** [TokenKind] representing ~/ tokens. */
143 static final int TRUNCDIV = 46;
144
145 /** [TokenKind] representing % tokens. */
146 static final int MOD = 47;
147
148 /** [TokenKind] representing == tokens. */
149 static final int EQ = 48;
150
151 /** [TokenKind] representing != tokens. */
152 static final int NE = 49;
153
154 /** [TokenKind] representing === tokens. */
155 static final int EQ_STRICT = 50;
156
157 /** [TokenKind] representing !== tokens. */
158 static final int NE_STRICT = 51;
159
160 /** [TokenKind] representing < tokens. */
161 static final int LT = 52;
162
163 /** [TokenKind] representing > tokens. */
164 static final int GT = 53;
165
166 /** [TokenKind] representing <= tokens. */
167 static final int LTE = 54;
168
169 /** [TokenKind] representing >= tokens. */
170 static final int GTE = 55;
171
172 /** [TokenKind] representing [] tokens. */
173 static final int INDEX = 56;
174
175 /** [TokenKind] representing []= tokens. */
176 static final int SETINDEX = 57;
177
178 /** [TokenKind] representing string tokens. */
179 static final int STRING = 58;
180
181 /** [TokenKind] representing string part tokens. */
182 static final int STRING_PART = 59;
183
184 /** [TokenKind] representing integer tokens. */
185 static final int INTEGER = 60;
186
187 /** [TokenKind] representing hex integer tokens. */
188 static final int HEX_INTEGER = 61;
189
190 /** [TokenKind] representing double tokens. */
191 static final int DOUBLE = 62;
192
193 /** [TokenKind] representing whitespace tokens. */
194 static final int WHITESPACE = 63;
195
196 /** [TokenKind] representing comment tokens. */
197 static final int COMMENT = 64;
198
199 /** [TokenKind] representing error tokens. */
200 static final int ERROR = 65;
201
202 /** [TokenKind] representing incomplete string tokens. */
203 static final int INCOMPLETE_STRING = 66;
204
205 /** [TokenKind] representing incomplete comment tokens. */
206 static final int INCOMPLETE_COMMENT = 67;
207
208 /** [TokenKind] representing incomplete multiline string dq tokens. */
209 static final int INCOMPLETE_MULTILINE_STRING_DQ = 68;
210
211 /** [TokenKind] representing incomplete multiline string sq tokens. */
212 static final int INCOMPLETE_MULTILINE_STRING_SQ = 69;
213
214 /** [TokenKind] representing identifier tokens. */
215 static final int IDENTIFIER = 70;
216
217 /** [TokenKind] representing pseudo-keyword 'abstract' tokens. */
218 static final int ABSTRACT = 71;
219
220 /** [TokenKind] representing pseudo-keyword 'assert' tokens. */
221 static final int ASSERT = 72;
222
223 /** [TokenKind] representing pseudo-keyword 'call' tokens. */
224 static final int CALL = 73;
225
226 /** [TokenKind] representing pseudo-keyword 'factory' tokens. */
227 static final int FACTORY = 74;
228
229 /** [TokenKind] representing pseudo-keyword 'get' tokens. */
230 static final int GET = 75;
231
232 /** [TokenKind] representing pseudo-keyword 'implements' tokens. */
233 static final int IMPLEMENTS = 76;
234
235 /** [TokenKind] representing pseudo-keyword 'import' tokens. */
236 static final int IMPORT = 77;
237
238 /** [TokenKind] representing pseudo-keyword 'interface' tokens. */
239 static final int INTERFACE = 78;
240
241 /** [TokenKind] representing pseudo-keyword 'library' tokens. */
242 static final int LIBRARY = 79;
243
244 /** [TokenKind] representing pseudo-keyword 'native' tokens. */
245 static final int NATIVE = 80;
246
247 /** [TokenKind] representing pseudo-keyword 'negate' tokens. */
248 static final int NEGATE = 81;
249
250 /** [TokenKind] representing pseudo-keyword 'operator' tokens. */
251 static final int OPERATOR = 82;
252
253 /** [TokenKind] representing pseudo-keyword 'set' tokens. */
254 static final int SET = 83;
255
256 /** [TokenKind] representing pseudo-keyword 'source' tokens. */
257 static final int SOURCE = 84;
258
259 /** [TokenKind] representing pseudo-keyword 'static' tokens. */
260 static final int STATIC = 85;
261
262 /** [TokenKind] representing pseudo-keyword 'typedef' tokens. */
263 static final int TYPEDEF = 86;
264
265 /** [TokenKind] representing keyword 'await' tokens. */
266 static final int AWAIT = 87;
267
268 /** [TokenKind] representing keyword 'break' tokens. */
269 static final int BREAK = 88;
270
271 /** [TokenKind] representing keyword 'case' tokens. */
272 static final int CASE = 89;
273
274 /** [TokenKind] representing keyword 'catch' tokens. */
275 static final int CATCH = 90;
276
277 /** [TokenKind] representing keyword 'class' tokens. */
278 static final int CLASS = 91;
279
280 /** [TokenKind] representing keyword 'const' tokens. */
281 static final int CONST = 92;
282
283 /** [TokenKind] representing keyword 'continue' tokens. */
284 static final int CONTINUE = 93;
285
286 /** [TokenKind] representing keyword 'default' tokens. */
287 static final int DEFAULT = 94;
288
289 /** [TokenKind] representing keyword 'do' tokens. */
290 static final int DO = 95;
291
292 /** [TokenKind] representing keyword 'else' tokens. */
293 static final int ELSE = 96;
294
295 /** [TokenKind] representing keyword 'extends' tokens. */
296 static final int EXTENDS = 97;
297
298 /** [TokenKind] representing keyword 'false' tokens. */
299 static final int FALSE = 98;
300
301 /** [TokenKind] representing keyword 'final' tokens. */
302 static final int FINAL = 99;
303
304 /** [TokenKind] representing keyword 'finally' tokens. */
305 static final int FINALLY = 100;
306
307 /** [TokenKind] representing keyword 'for' tokens. */
308 static final int FOR = 101;
309
310 /** [TokenKind] representing keyword 'if' tokens. */
311 static final int IF = 102;
312
313 /** [TokenKind] representing keyword 'in' tokens. */
314 static final int IN = 103;
315
316 /** [TokenKind] representing keyword 'is' tokens. */
317 static final int IS = 104;
318
319 /** [TokenKind] representing keyword 'new' tokens. */
320 static final int NEW = 105;
321
322 /** [TokenKind] representing keyword 'null' tokens. */
323 static final int NULL = 106;
324
325 /** [TokenKind] representing keyword 'return' tokens. */
326 static final int RETURN = 107;
327
328 /** [TokenKind] representing keyword 'super' tokens. */
329 static final int SUPER = 108;
330
331 /** [TokenKind] representing keyword 'switch' tokens. */
332 static final int SWITCH = 109;
333
334 /** [TokenKind] representing keyword 'this' tokens. */
335 static final int THIS = 110;
336
337 /** [TokenKind] representing keyword 'throw' tokens. */
338 static final int THROW = 111;
339
340 /** [TokenKind] representing keyword 'true' tokens. */
341 static final int TRUE = 112;
342
343 /** [TokenKind] representing keyword 'try' tokens. */
344 static final int TRY = 113;
345
346 /** [TokenKind] representing keyword 'var' tokens. */
347 static final int VAR = 114;
348
349 /** [TokenKind] representing keyword 'void' tokens. */
350 static final int VOID = 115;
351
352 /** [TokenKind] representing keyword 'while' tokens. */
353 static final int WHILE = 116;
354
355 static String kindToString(int kind) {
356 switch(kind) {
357 case TokenKind.END_OF_FILE: return "end of file";
358 case TokenKind.LPAREN: return "(";
359 case TokenKind.RPAREN: return ")";
360 case TokenKind.LBRACK: return "[";
361 case TokenKind.RBRACK: return "]";
362 case TokenKind.LBRACE: return "{";
363 case TokenKind.RBRACE: return "}";
364 case TokenKind.COLON: return ":";
365 case TokenKind.ARROW: return "=>";
366 case TokenKind.SEMICOLON: return ";";
367 case TokenKind.COMMA: return ",";
368 case TokenKind.HASH: return "#";
369 case TokenKind.HASHBANG: return "#!";
370 case TokenKind.DOT: return ".";
371 case TokenKind.ELLIPSIS: return "...";
372 case TokenKind.INCR: return "++";
373 case TokenKind.DECR: return "--";
374 case TokenKind.BIT_NOT: return "~";
375 case TokenKind.NOT: return "!";
376 case TokenKind.ASSIGN: return "=";
377 case TokenKind.ASSIGN_OR: return "|=";
378 case TokenKind.ASSIGN_XOR: return "^=";
379 case TokenKind.ASSIGN_AND: return "&=";
380 case TokenKind.ASSIGN_SHL: return "<<=";
381 case TokenKind.ASSIGN_SAR: return ">>=";
382 case TokenKind.ASSIGN_SHR: return ">>>=";
383 case TokenKind.ASSIGN_ADD: return "+=";
384 case TokenKind.ASSIGN_SUB: return "-=";
385 case TokenKind.ASSIGN_MUL: return "*=";
386 case TokenKind.ASSIGN_DIV: return "/=";
387 case TokenKind.ASSIGN_TRUNCDIV: return "~/=";
388 case TokenKind.ASSIGN_MOD: return "%=";
389 case TokenKind.CONDITIONAL: return "?";
390 case TokenKind.OR: return "||";
391 case TokenKind.AND: return "&&";
392 case TokenKind.BIT_OR: return "|";
393 case TokenKind.BIT_XOR: return "^";
394 case TokenKind.BIT_AND: return "&";
395 case TokenKind.SHL: return "<<";
396 case TokenKind.SAR: return ">>";
397 case TokenKind.SHR: return ">>>";
398 case TokenKind.ADD: return "+";
399 case TokenKind.SUB: return "-";
400 case TokenKind.MUL: return "*";
401 case TokenKind.DIV: return "/";
402 case TokenKind.TRUNCDIV: return "~/";
403 case TokenKind.MOD: return "%";
404 case TokenKind.EQ: return "==";
405 case TokenKind.NE: return "!=";
406 case TokenKind.EQ_STRICT: return "===";
407 case TokenKind.NE_STRICT: return "!==";
408 case TokenKind.LT: return "<";
409 case TokenKind.GT: return ">";
410 case TokenKind.LTE: return "<=";
411 case TokenKind.GTE: return ">=";
412 case TokenKind.INDEX: return "[]";
413 case TokenKind.SETINDEX: return "[]=";
414 case TokenKind.STRING: return "string";
415 case TokenKind.STRING_PART: return "string part";
416 case TokenKind.INTEGER: return "integer";
417 case TokenKind.HEX_INTEGER: return "hex integer";
418 case TokenKind.DOUBLE: return "double";
419 case TokenKind.WHITESPACE: return "whitespace";
420 case TokenKind.COMMENT: return "comment";
421 case TokenKind.ERROR: return "error";
422 case TokenKind.INCOMPLETE_STRING: return "incomplete string";
423 case TokenKind.INCOMPLETE_COMMENT: return "incomplete comment";
424 case TokenKind.INCOMPLETE_MULTILINE_STRING_DQ: return "incomplete multilin e string dq";
425 case TokenKind.INCOMPLETE_MULTILINE_STRING_SQ: return "incomplete multilin e string sq";
426 case TokenKind.IDENTIFIER: return "identifier";
427 case TokenKind.ABSTRACT: return "pseudo-keyword 'abstract'";
428 case TokenKind.ASSERT: return "pseudo-keyword 'assert'";
429 case TokenKind.CALL: return "pseudo-keyword 'call'";
430 case TokenKind.FACTORY: return "pseudo-keyword 'factory'";
431 case TokenKind.GET: return "pseudo-keyword 'get'";
432 case TokenKind.IMPLEMENTS: return "pseudo-keyword 'implements'";
433 case TokenKind.IMPORT: return "pseudo-keyword 'import'";
434 case TokenKind.INTERFACE: return "pseudo-keyword 'interface'";
435 case TokenKind.LIBRARY: return "pseudo-keyword 'library'";
436 case TokenKind.NATIVE: return "pseudo-keyword 'native'";
437 case TokenKind.NEGATE: return "pseudo-keyword 'negate'";
438 case TokenKind.OPERATOR: return "pseudo-keyword 'operator'";
439 case TokenKind.SET: return "pseudo-keyword 'set'";
440 case TokenKind.SOURCE: return "pseudo-keyword 'source'";
441 case TokenKind.STATIC: return "pseudo-keyword 'static'";
442 case TokenKind.TYPEDEF: return "pseudo-keyword 'typedef'";
443 case TokenKind.AWAIT: return "keyword 'await'";
444 case TokenKind.BREAK: return "keyword 'break'";
445 case TokenKind.CASE: return "keyword 'case'";
446 case TokenKind.CATCH: return "keyword 'catch'";
447 case TokenKind.CLASS: return "keyword 'class'";
448 case TokenKind.CONST: return "keyword 'const'";
449 case TokenKind.CONTINUE: return "keyword 'continue'";
450 case TokenKind.DEFAULT: return "keyword 'default'";
451 case TokenKind.DO: return "keyword 'do'";
452 case TokenKind.ELSE: return "keyword 'else'";
453 case TokenKind.EXTENDS: return "keyword 'extends'";
454 case TokenKind.FALSE: return "keyword 'false'";
455 case TokenKind.FINAL: return "keyword 'final'";
456 case TokenKind.FINALLY: return "keyword 'finally'";
457 case TokenKind.FOR: return "keyword 'for'";
458 case TokenKind.IF: return "keyword 'if'";
459 case TokenKind.IN: return "keyword 'in'";
460 case TokenKind.IS: return "keyword 'is'";
461 case TokenKind.NEW: return "keyword 'new'";
462 case TokenKind.NULL: return "keyword 'null'";
463 case TokenKind.RETURN: return "keyword 'return'";
464 case TokenKind.SUPER: return "keyword 'super'";
465 case TokenKind.SWITCH: return "keyword 'switch'";
466 case TokenKind.THIS: return "keyword 'this'";
467 case TokenKind.THROW: return "keyword 'throw'";
468 case TokenKind.TRUE: return "keyword 'true'";
469 case TokenKind.TRY: return "keyword 'try'";
470 case TokenKind.VAR: return "keyword 'var'";
471 case TokenKind.VOID: return "keyword 'void'";
472 case TokenKind.WHILE: return "keyword 'while'";
473 default: return "TokenKind(" + kind.toString() + ")";
474 }
475 }
476
477 static bool isIdentifier(int kind) {
478 return kind >= IDENTIFIER && kind < AWAIT;
479 }
480
481 static int infixPrecedence(int kind) {
482 switch(kind) {
483 case ASSIGN: return 2;
484 case ASSIGN_OR: return 2;
485 case ASSIGN_XOR: return 2;
486 case ASSIGN_AND: return 2;
487 case ASSIGN_SHL: return 2;
488 case ASSIGN_SAR: return 2;
489 case ASSIGN_SHR: return 2;
490 case ASSIGN_ADD: return 2;
491 case ASSIGN_SUB: return 2;
492 case ASSIGN_MUL: return 2;
493 case ASSIGN_DIV: return 2;
494 case ASSIGN_TRUNCDIV: return 2;
495 case ASSIGN_MOD: return 2;
496 case CONDITIONAL: return 3;
497 case OR: return 4;
498 case AND: return 5;
499 case BIT_OR: return 6;
500 case BIT_XOR: return 7;
501 case BIT_AND: return 8;
502 case SHL: return 11;
503 case SAR: return 11;
504 case SHR: return 11;
505 case ADD: return 12;
506 case SUB: return 12;
507 case MUL: return 13;
508 case DIV: return 13;
509 case TRUNCDIV: return 13;
510 case MOD: return 13;
511 case EQ: return 9;
512 case NE: return 9;
513 case EQ_STRICT: return 9;
514 case NE_STRICT: return 9;
515 case LT: return 10;
516 case GT: return 10;
517 case LTE: return 10;
518 case GTE: return 10;
519 case IS: return 10;
520 default: return -1;
521 }
522 }
523
524 static String rawOperatorFromMethod(String name) {
525 switch(name) {
526 case ':bit_not': return '~';
527 case ':bit_or': return '|';
528 case ':bit_xor': return '^';
529 case ':bit_and': return '&';
530 case ':shl': return '<<';
531 case ':sar': return '>>';
532 case ':shr': return '>>>';
533 case ':add': return '+';
534 case ':sub': return '-';
535 case ':mul': return '*';
536 case ':div': return '/';
537 case ':truncdiv': return '~/';
538 case ':mod': return '%';
539 case ':eq': return '==';
540 case ':lt': return '<';
541 case ':gt': return '>';
542 case ':lte': return '<=';
543 case ':gte': return '>=';
544 case ':index': return '[]';
545 case ':setindex': return '[]=';
546 case ':ne': return '!=';
547 }
548 }
549
550 static String binaryMethodName(int kind) {
551 switch(kind) {
552 case BIT_NOT: return ':bit_not';
553 case BIT_OR: return ':bit_or';
554 case BIT_XOR: return ':bit_xor';
555 case BIT_AND: return ':bit_and';
556 case SHL: return ':shl';
557 case SAR: return ':sar';
558 case SHR: return ':shr';
559 case ADD: return ':add';
560 case SUB: return ':sub';
561 case MUL: return ':mul';
562 case DIV: return ':div';
563 case TRUNCDIV: return ':truncdiv';
564 case MOD: return ':mod';
565 case EQ: return ':eq';
566 case LT: return ':lt';
567 case GT: return ':gt';
568 case LTE: return ':lte';
569 case GTE: return ':gte';
570 case INDEX: return ':index';
571 case SETINDEX: return ':setindex';
572 }
573 }
574
575 static String unaryMethodName(int kind) {
576 }
577
578 static int kindFromAssign(int kind) {
579 if (kind == ASSIGN) return 0;
580 if (kind > ASSIGN && kind <= ASSIGN_MOD) {
581 return kind + (ADD - ASSIGN_ADD);
582 }
583 return -1;
584 }
585 }
OLDNEW
« no previous file with comments | « frog/token.dart ('k') | frog/tokenizer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698