| 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 library fasta.scanner.token; | 5 library fasta.scanner.token; |
| 6 | 6 |
| 7 import 'keyword.dart' show Keyword; | 7 import 'keyword.dart' show Keyword; |
| 8 | 8 |
| 9 import 'precedence.dart' show BAD_INPUT_INFO, EOF_INFO, PrecedenceInfo; | 9 import 'precedence.dart' show BAD_INPUT_INFO, EOF_INFO, PrecedenceInfo; |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 * The precedence level for this token. | 89 * The precedence level for this token. |
| 90 */ | 90 */ |
| 91 int get precedence => info.precedence; | 91 int get precedence => info.precedence; |
| 92 | 92 |
| 93 /** | 93 /** |
| 94 * True if this token is an identifier. Some keywords allowed as identifiers, | 94 * True if this token is an identifier. Some keywords allowed as identifiers, |
| 95 * see implementation in [KeywordToken]. | 95 * see implementation in [KeywordToken]. |
| 96 */ | 96 */ |
| 97 bool isIdentifier(); | 97 bool isIdentifier(); |
| 98 | 98 |
| 99 bool get isPseudo => false; |
| 100 |
| 99 /** | 101 /** |
| 100 * Returns a textual representation of this token to be used for debugging | 102 * Returns a textual representation of this token to be used for debugging |
| 101 * purposes. The resulting string might contain information about the | 103 * purposes. The resulting string might contain information about the |
| 102 * structure of the token, for example 'StringToken(foo)' for the identifier | 104 * structure of the token, for example 'StringToken(foo)' for the identifier |
| 103 * token 'foo'. | 105 * token 'foo'. |
| 104 * | 106 * |
| 105 * Use [lexeme] for the text actually parsed by the token. | 107 * Use [lexeme] for the text actually parsed by the token. |
| 106 */ | 108 */ |
| 107 String toString(); | 109 String toString(); |
| 108 | 110 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 KeywordToken(this.keyword, int charOffset) : super(charOffset); | 173 KeywordToken(this.keyword, int charOffset) : super(charOffset); |
| 172 | 174 |
| 173 PrecedenceInfo get info => keyword.info; | 175 PrecedenceInfo get info => keyword.info; |
| 174 | 176 |
| 175 String get lexeme => keyword.syntax; | 177 String get lexeme => keyword.syntax; |
| 176 | 178 |
| 177 String get stringValue => keyword.syntax; | 179 String get stringValue => keyword.syntax; |
| 178 | 180 |
| 179 bool isIdentifier() => keyword.isPseudo || keyword.isBuiltIn; | 181 bool isIdentifier() => keyword.isPseudo || keyword.isBuiltIn; |
| 180 | 182 |
| 183 bool get isPseudo => keyword.isPseudo; |
| 184 |
| 181 bool get isBuiltInIdentifier { | 185 bool get isBuiltInIdentifier { |
| 182 // TODO(ahe): Remove special case for "deferred" once dartbug.com/29069 is | 186 // TODO(ahe): Remove special case for "deferred" once dartbug.com/29069 is |
| 183 // fixed. | 187 // fixed. |
| 184 return keyword.isBuiltIn || identical("deferred", lexeme); | 188 return keyword.isBuiltIn || identical("deferred", lexeme); |
| 185 } | 189 } |
| 186 | 190 |
| 187 String toString() => "KeywordToken($lexeme)"; | 191 String toString() => "KeywordToken($lexeme)"; |
| 188 } | 192 } |
| 189 | 193 |
| 190 /** | 194 /** |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 identical(value, "<=") || | 382 identical(value, "<=") || |
| 379 identical(value, "<") || | 383 identical(value, "<") || |
| 380 identical(value, "&") || | 384 identical(value, "&") || |
| 381 identical(value, "^") || | 385 identical(value, "^") || |
| 382 identical(value, "|"); | 386 identical(value, "|"); |
| 383 } | 387 } |
| 384 | 388 |
| 385 bool isTernaryOperator(String value) => identical(value, "[]="); | 389 bool isTernaryOperator(String value) => identical(value, "[]="); |
| 386 | 390 |
| 387 bool isMinusOperator(String value) => identical(value, "-"); | 391 bool isMinusOperator(String value) => identical(value, "-"); |
| OLD | NEW |