OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 final int EOF_TOKEN = 0; | 5 final int EOF_TOKEN = 0; |
6 | 6 |
7 final int KEYWORD_TOKEN = $k; | 7 final int KEYWORD_TOKEN = $k; |
8 final int IDENTIFIER_TOKEN = $a; | 8 final int IDENTIFIER_TOKEN = $a; |
9 final int DOUBLE_TOKEN = $d; | 9 final int DOUBLE_TOKEN = $d; |
10 final int INT_TOKEN = $i; | 10 final int INT_TOKEN = $i; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 final int PLUS_PLUS_TOKEN = STAR_EQ_TOKEN + 1; | 64 final int PLUS_PLUS_TOKEN = STAR_EQ_TOKEN + 1; |
65 final int PLUS_EQ_TOKEN = PLUS_PLUS_TOKEN + 1; | 65 final int PLUS_EQ_TOKEN = PLUS_PLUS_TOKEN + 1; |
66 final int MINUS_MINUS_TOKEN = PLUS_EQ_TOKEN + 1; | 66 final int MINUS_MINUS_TOKEN = PLUS_EQ_TOKEN + 1; |
67 final int MINUS_EQ_TOKEN = MINUS_MINUS_TOKEN + 1; | 67 final int MINUS_EQ_TOKEN = MINUS_MINUS_TOKEN + 1; |
68 final int TILDE_SLASH_EQ_TOKEN = MINUS_EQ_TOKEN + 1; | 68 final int TILDE_SLASH_EQ_TOKEN = MINUS_EQ_TOKEN + 1; |
69 final int TILDE_SLASH_TOKEN = TILDE_SLASH_EQ_TOKEN + 1; | 69 final int TILDE_SLASH_TOKEN = TILDE_SLASH_EQ_TOKEN + 1; |
70 final int PERCENT_EQ_TOKEN = TILDE_SLASH_TOKEN + 1; | 70 final int PERCENT_EQ_TOKEN = TILDE_SLASH_TOKEN + 1; |
71 final int GT_GT_TOKEN = PERCENT_EQ_TOKEN + 1; | 71 final int GT_GT_TOKEN = PERCENT_EQ_TOKEN + 1; |
72 final int CARET_EQ_TOKEN = GT_GT_TOKEN + 1; | 72 final int CARET_EQ_TOKEN = GT_GT_TOKEN + 1; |
73 final int IS_TOKEN = CARET_EQ_TOKEN + 1; | 73 final int IS_TOKEN = CARET_EQ_TOKEN + 1; |
| 74 final int AS_TOKEN = IS_TOKEN + 1; |
74 | 75 |
75 // TODO(ahe): Get rid of this. | 76 // TODO(ahe): Get rid of this. |
76 final int UNKNOWN_TOKEN = 1024; | 77 final int UNKNOWN_TOKEN = 1024; |
77 | 78 |
78 /** | 79 /** |
79 * A token that doubles as a linked list. | 80 * A token that doubles as a linked list. |
80 */ | 81 */ |
81 class Token { | 82 class Token { |
82 final PrecedenceInfo info; | 83 final PrecedenceInfo info; |
83 final int charOffset; | 84 final int charOffset; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 final PrecedenceInfo EQ_EQ_INFO = | 354 final PrecedenceInfo EQ_EQ_INFO = |
354 const PrecedenceInfo(const SourceString('=='), 9, EQ_EQ_TOKEN); | 355 const PrecedenceInfo(const SourceString('=='), 9, EQ_EQ_TOKEN); |
355 | 356 |
356 // Relational operators. | 357 // Relational operators. |
357 final PrecedenceInfo GT_EQ_INFO = | 358 final PrecedenceInfo GT_EQ_INFO = |
358 const PrecedenceInfo(const SourceString('>='), 10, GT_EQ_TOKEN); | 359 const PrecedenceInfo(const SourceString('>='), 10, GT_EQ_TOKEN); |
359 final PrecedenceInfo GT_INFO = | 360 final PrecedenceInfo GT_INFO = |
360 const PrecedenceInfo(const SourceString('>'), 10, GT_TOKEN); | 361 const PrecedenceInfo(const SourceString('>'), 10, GT_TOKEN); |
361 final PrecedenceInfo IS_INFO = | 362 final PrecedenceInfo IS_INFO = |
362 const PrecedenceInfo(const SourceString('is'), 10, IS_TOKEN); | 363 const PrecedenceInfo(const SourceString('is'), 10, IS_TOKEN); |
| 364 final PrecedenceInfo AS_INFO = |
| 365 const PrecedenceInfo(const SourceString('as'), 10, AS_TOKEN); |
363 final PrecedenceInfo LT_EQ_INFO = | 366 final PrecedenceInfo LT_EQ_INFO = |
364 const PrecedenceInfo(const SourceString('<='), 10, LT_EQ_TOKEN); | 367 const PrecedenceInfo(const SourceString('<='), 10, LT_EQ_TOKEN); |
365 final PrecedenceInfo LT_INFO = | 368 final PrecedenceInfo LT_INFO = |
366 const PrecedenceInfo(const SourceString('<'), 10, LT_TOKEN); | 369 const PrecedenceInfo(const SourceString('<'), 10, LT_TOKEN); |
367 | 370 |
368 // Shift operators. | 371 // Shift operators. |
369 final PrecedenceInfo GT_GT_GT_INFO = | 372 final PrecedenceInfo GT_GT_GT_INFO = |
370 const PrecedenceInfo(const SourceString('>>>'), 11, GT_GT_TOKEN); | 373 const PrecedenceInfo(const SourceString('>>>'), 11, GT_GT_TOKEN); |
371 final PrecedenceInfo GT_GT_INFO = | 374 final PrecedenceInfo GT_GT_INFO = |
372 const PrecedenceInfo(const SourceString('>>'), 11, GT_GT_TOKEN); | 375 const PrecedenceInfo(const SourceString('>>'), 11, GT_GT_TOKEN); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 final PrecedenceInfo STRING_INTERPOLATION_INFO = | 438 final PrecedenceInfo STRING_INTERPOLATION_INFO = |
436 const PrecedenceInfo(const SourceString('\${'), 0, | 439 const PrecedenceInfo(const SourceString('\${'), 0, |
437 STRING_INTERPOLATION_TOKEN); | 440 STRING_INTERPOLATION_TOKEN); |
438 | 441 |
439 final PrecedenceInfo HEXADECIMAL_INFO = | 442 final PrecedenceInfo HEXADECIMAL_INFO = |
440 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); | 443 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); |
441 | 444 |
442 // For reporting lexical errors. | 445 // For reporting lexical errors. |
443 final PrecedenceInfo ERROR_INFO = | 446 final PrecedenceInfo ERROR_INFO = |
444 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); | 447 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); |
OLD | NEW |