| 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 const int EOF_TOKEN = 0; | 5 const int EOF_TOKEN = 0; |
| 6 | 6 |
| 7 const int KEYWORD_TOKEN = $k; | 7 const int KEYWORD_TOKEN = $k; |
| 8 const int IDENTIFIER_TOKEN = $a; | 8 const int IDENTIFIER_TOKEN = $a; |
| 9 const int BAD_INPUT_TOKEN = $X; | 9 const int BAD_INPUT_TOKEN = $X; |
| 10 const int DOUBLE_TOKEN = $d; | 10 const int DOUBLE_TOKEN = $d; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 const int COMMENT_TOKEN = AS_TOKEN + 1; | 77 const int COMMENT_TOKEN = AS_TOKEN + 1; |
| 78 const int GT_GT_GT_TOKEN = COMMENT_TOKEN + 1; | 78 const int GT_GT_GT_TOKEN = COMMENT_TOKEN + 1; |
| 79 const int STRING_INTERPOLATION_IDENTIFIER_TOKEN = COMMENT_TOKEN + 1; | 79 const int STRING_INTERPOLATION_IDENTIFIER_TOKEN = COMMENT_TOKEN + 1; |
| 80 | 80 |
| 81 // TODO(ahe): Get rid of this. | 81 // TODO(ahe): Get rid of this. |
| 82 const int UNKNOWN_TOKEN = 1024; | 82 const int UNKNOWN_TOKEN = 1024; |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * A token that doubles as a linked list. | 85 * A token that doubles as a linked list. |
| 86 */ | 86 */ |
| 87 class Token { | 87 class Token implements Spannable { |
| 88 /** | 88 /** |
| 89 * The precedence info for this token. [info] determines the kind and the | 89 * The precedence info for this token. [info] determines the kind and the |
| 90 * precedence level of this token. | 90 * precedence level of this token. |
| 91 */ | 91 */ |
| 92 final PrecedenceInfo info; | 92 final PrecedenceInfo info; |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * The character offset of the start of this token within the source text. | 95 * The character offset of the start of this token within the source text. |
| 96 */ | 96 */ |
| 97 final int charOffset; | 97 final int charOffset; |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 503 |
| 504 const PrecedenceInfo HEXADECIMAL_INFO = | 504 const PrecedenceInfo HEXADECIMAL_INFO = |
| 505 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); | 505 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); |
| 506 | 506 |
| 507 const PrecedenceInfo COMMENT_INFO = | 507 const PrecedenceInfo COMMENT_INFO = |
| 508 const PrecedenceInfo(const SourceString('comment'), 0, COMMENT_TOKEN); | 508 const PrecedenceInfo(const SourceString('comment'), 0, COMMENT_TOKEN); |
| 509 | 509 |
| 510 // For reporting lexical errors. | 510 // For reporting lexical errors. |
| 511 const PrecedenceInfo ERROR_INFO = | 511 const PrecedenceInfo ERROR_INFO = |
| 512 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); | 512 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); |
| OLD | NEW |