| 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 DOUBLE_TOKEN = $d; | 9 const int DOUBLE_TOKEN = $d; |
| 10 const int INT_TOKEN = $i; | 10 const int INT_TOKEN = $i; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 /** | 117 /** |
| 118 * The kind enum of this token as determined by its [info]. | 118 * The kind enum of this token as determined by its [info]. |
| 119 */ | 119 */ |
| 120 int get kind => info.kind; | 120 int get kind => info.kind; |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * The precedence level for this token. | 123 * The precedence level for this token. |
| 124 */ | 124 */ |
| 125 int get precedence => info.precedence; | 125 int get precedence => info.precedence; |
| 126 | 126 |
| 127 bool isIdentifier() { |
| 128 if (kind === IDENTIFIER_TOKEN) return true; |
| 129 if (kind === KEYWORD_TOKEN) return value.isPseudo; |
| 130 return false; |
| 131 } |
| 132 |
| 127 /** | 133 /** |
| 128 * Returns a textual representation of this token to be used for debugging | 134 * Returns a textual representation of this token to be used for debugging |
| 129 * purposes. The resulting string might contain information about the | 135 * purposes. The resulting string might contain information about the |
| 130 * structure of the token, for example 'StringToken(foo)' for the identifier | 136 * structure of the token, for example 'StringToken(foo)' for the identifier |
| 131 * token 'foo'. Use [slowToString] for the text actually parsed by the token. | 137 * token 'foo'. Use [slowToString] for the text actually parsed by the token. |
| 132 */ | 138 */ |
| 133 String toString() => info.value.toString(); | 139 String toString() => info.value.toString(); |
| 134 | 140 |
| 135 /** | 141 /** |
| 136 * The text parsed by this token. | 142 * The text parsed by this token. |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 500 |
| 495 const PrecedenceInfo HEXADECIMAL_INFO = | 501 const PrecedenceInfo HEXADECIMAL_INFO = |
| 496 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); | 502 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); |
| 497 | 503 |
| 498 const PrecedenceInfo COMMENT_INFO = | 504 const PrecedenceInfo COMMENT_INFO = |
| 499 const PrecedenceInfo(const SourceString('comment'), 0, COMMENT_TOKEN); | 505 const PrecedenceInfo(const SourceString('comment'), 0, COMMENT_TOKEN); |
| 500 | 506 |
| 501 // For reporting lexical errors. | 507 // For reporting lexical errors. |
| 502 const PrecedenceInfo ERROR_INFO = | 508 const PrecedenceInfo ERROR_INFO = |
| 503 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); | 509 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); |
| OLD | NEW |