| 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 '../../scanner/token.dart' as analyzer; | 7 import '../../scanner/token.dart' as analyzer; |
| 8 | 8 |
| 9 import 'keyword.dart' show Keyword; | 9 import 'keyword.dart' show Keyword; |
| 10 | 10 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 PrecedenceInfo get info => keyword.info; | 310 PrecedenceInfo get info => keyword.info; |
| 311 | 311 |
| 312 String get lexeme => keyword.syntax; | 312 String get lexeme => keyword.syntax; |
| 313 | 313 |
| 314 String get stringValue => keyword.syntax; | 314 String get stringValue => keyword.syntax; |
| 315 | 315 |
| 316 bool isIdentifier() => keyword.isPseudo || keyword.isBuiltIn; | 316 bool isIdentifier() => keyword.isPseudo || keyword.isBuiltIn; |
| 317 | 317 |
| 318 bool get isPseudo => keyword.isPseudo; | 318 bool get isPseudo => keyword.isPseudo; |
| 319 | 319 |
| 320 bool get isBuiltInIdentifier { | 320 bool get isBuiltInIdentifier => keyword.isBuiltIn; |
| 321 // TODO(ahe): Remove special case for "deferred" once dartbug.com/29069 is | |
| 322 // fixed. | |
| 323 return keyword.isBuiltIn || identical("deferred", lexeme); | |
| 324 } | |
| 325 | 321 |
| 326 String toString() => "KeywordToken($lexeme)"; | 322 String toString() => "KeywordToken($lexeme)"; |
| 327 | 323 |
| 328 @override | 324 @override |
| 329 Token copyWithoutComments() => new KeywordToken(keyword, charOffset); | 325 Token copyWithoutComments() => new KeywordToken(keyword, charOffset); |
| 330 | 326 |
| 331 @override | 327 @override |
| 332 Object value() { | 328 // Analyzer considers pseudo-keywords to have a different value |
| 333 // Analyzer has different set of keyword tokens | 329 Object value() => isPseudo ? lexeme : keyword; |
| 334 // TODO(danrubel): Remove special case for "deferred" once dartbug.com/29069 | |
| 335 // is fixed. | |
| 336 return isPseudo && !identical("deferred", lexeme) ? lexeme : keyword; | |
| 337 } | |
| 338 | 330 |
| 339 @override | 331 @override |
| 340 analyzer.TokenType get type { | 332 // Analyzer considers pseudo-keywords to be identifiers |
| 341 // Analyzer considers pseudo-keywords to be identifiers | 333 analyzer.TokenType get type => isPseudo ? IDENTIFIER_INFO : KEYWORD_INFO; |
| 342 // TODO(danrubel): Remove special case for "deferred" once dartbug.com/29069 | |
| 343 // is fixed. | |
| 344 return isPseudo && !identical("deferred", lexeme) | |
| 345 ? IDENTIFIER_INFO | |
| 346 : KEYWORD_INFO; | |
| 347 } | |
| 348 } | 334 } |
| 349 | 335 |
| 350 /** | 336 /** |
| 351 * A String-valued token. Represents identifiers, string literals, | 337 * A String-valued token. Represents identifiers, string literals, |
| 352 * number literals, comments, and error tokens, using the corresponding | 338 * number literals, comments, and error tokens, using the corresponding |
| 353 * precedence info. | 339 * precedence info. |
| 354 */ | 340 */ |
| 355 class StringToken extends Token implements analyzer.StringToken { | 341 class StringToken extends Token implements analyzer.StringToken { |
| 356 /** | 342 /** |
| 357 * The length threshold above which substring tokens are computed lazily. | 343 * The length threshold above which substring tokens are computed lazily. |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 identical(value, "<=") || | 620 identical(value, "<=") || |
| 635 identical(value, "<") || | 621 identical(value, "<") || |
| 636 identical(value, "&") || | 622 identical(value, "&") || |
| 637 identical(value, "^") || | 623 identical(value, "^") || |
| 638 identical(value, "|"); | 624 identical(value, "|"); |
| 639 } | 625 } |
| 640 | 626 |
| 641 bool isTernaryOperator(String value) => identical(value, "[]="); | 627 bool isTernaryOperator(String value) => identical(value, "[]="); |
| 642 | 628 |
| 643 bool isMinusOperator(String value) => identical(value, "-"); | 629 bool isMinusOperator(String value) => identical(value, "-"); |
| OLD | NEW |