| 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 |
| 11 import 'precedence.dart' | 11 import 'precedence.dart' |
| 12 show | 12 show |
| 13 AS_INFO, | 13 AS_INFO, |
| 14 BAD_INPUT_INFO, | 14 BAD_INPUT_INFO, |
| 15 EOF_INFO, | 15 EOF_INFO, |
| 16 IDENTIFIER_INFO, | |
| 17 IS_INFO, | 16 IS_INFO, |
| 18 KEYWORD_INFO, | 17 KEYWORD_INFO, |
| 19 PrecedenceInfo; | 18 PrecedenceInfo; |
| 20 | 19 |
| 21 import 'token_constants.dart' show IDENTIFIER_TOKEN; | 20 import 'token_constants.dart' show IDENTIFIER_TOKEN; |
| 22 | 21 |
| 23 import 'string_canonicalizer.dart'; | 22 import 'string_canonicalizer.dart'; |
| 24 | 23 |
| 25 /** | 24 /** |
| 26 * A token that doubles as a linked list. | 25 * A token that doubles as a linked list. |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 bool get isPseudo => keyword.isPseudo; | 350 bool get isPseudo => keyword.isPseudo; |
| 352 | 351 |
| 353 bool get isBuiltInIdentifier => keyword.isBuiltIn; | 352 bool get isBuiltInIdentifier => keyword.isBuiltIn; |
| 354 | 353 |
| 355 String toString() => "KeywordToken($lexeme)"; | 354 String toString() => "KeywordToken($lexeme)"; |
| 356 | 355 |
| 357 @override | 356 @override |
| 358 Token copyWithoutComments() => new KeywordToken(keyword, charOffset); | 357 Token copyWithoutComments() => new KeywordToken(keyword, charOffset); |
| 359 | 358 |
| 360 @override | 359 @override |
| 361 // Analyzer considers pseudo-keywords to have a different value | 360 Keyword value() => keyword; |
| 362 Object value() => isPseudo ? lexeme : keyword; | |
| 363 | 361 |
| 364 @override | 362 @override |
| 365 // Analyzer considers pseudo-keywords to be identifiers | 363 analyzer.TokenType get type => KEYWORD_INFO; |
| 366 analyzer.TokenType get type => isPseudo ? IDENTIFIER_INFO : KEYWORD_INFO; | |
| 367 } | 364 } |
| 368 | 365 |
| 369 /** | 366 /** |
| 370 * A synthetic keyword token. | 367 * A synthetic keyword token. |
| 371 */ | 368 */ |
| 372 class SyntheticKeywordToken extends KeywordToken | 369 class SyntheticKeywordToken extends KeywordToken |
| 373 implements analyzer.SyntheticKeywordToken { | 370 implements analyzer.SyntheticKeywordToken { |
| 374 /** | 371 /** |
| 375 * Initialize a newly created token to represent the given [keyword] at the | 372 * Initialize a newly created token to represent the given [keyword] at the |
| 376 * given [offset]. | 373 * given [offset]. |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 identical(value, "<=") || | 690 identical(value, "<=") || |
| 694 identical(value, "<") || | 691 identical(value, "<") || |
| 695 identical(value, "&") || | 692 identical(value, "&") || |
| 696 identical(value, "^") || | 693 identical(value, "^") || |
| 697 identical(value, "|"); | 694 identical(value, "|"); |
| 698 } | 695 } |
| 699 | 696 |
| 700 bool isTernaryOperator(String value) => identical(value, "[]="); | 697 bool isTernaryOperator(String value) => identical(value, "[]="); |
| 701 | 698 |
| 702 bool isMinusOperator(String value) => identical(value, "-"); | 699 bool isMinusOperator(String value) => identical(value, "-"); |
| OLD | NEW |