Chromium Code Reviews| 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 import '../../scanner/token.dart' show TokenType; | 8 import '../../scanner/token.dart' show TokenType; |
| 9 | 9 |
| 10 import 'package:kernel/ast.dart' show TreeNode; | |
|
ahe
2017/04/25 17:39:59
It feels a bit much to import package:kernel here
Paul Berry
2017/04/25 22:00:55
What's bothering you, the import of kernel or the
ahe
2017/04/26 08:34:36
Both, I think.
| |
| 11 | |
| 10 import 'precedence.dart' | 12 import 'precedence.dart' |
| 11 show AS_INFO, BAD_INPUT_INFO, EOF_INFO, IS_INFO, KEYWORD_INFO; | 13 show AS_INFO, BAD_INPUT_INFO, EOF_INFO, IS_INFO, KEYWORD_INFO; |
| 12 | 14 |
| 13 import 'token_constants.dart' show IDENTIFIER_TOKEN; | 15 import 'token_constants.dart' show IDENTIFIER_TOKEN; |
| 14 | 16 |
| 15 import 'string_canonicalizer.dart'; | 17 import 'string_canonicalizer.dart'; |
| 16 | 18 |
| 19 /// A null-aware alternative to `token.offset`. If [token] is `null`, returns | |
| 20 /// `TreeNode.noOffset`. | |
| 21 int offsetForToken(Token token) => | |
| 22 token == null ? TreeNode.noOffset : token.offset; | |
| 23 | |
| 17 /** | 24 /** |
| 18 * A token that doubles as a linked list. | 25 * A token that doubles as a linked list. |
| 19 */ | 26 */ |
| 20 abstract class Token implements analyzer.TokenWithComment { | 27 abstract class Token implements analyzer.TokenWithComment { |
| 21 /** | 28 /** |
| 22 * The character offset of the start of this token within the source text. | 29 * The character offset of the start of this token within the source text. |
| 23 */ | 30 */ |
| 24 int charOffset; | 31 int charOffset; |
| 25 | 32 |
| 26 Token(this.charOffset); | 33 Token(this.charOffset); |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 identical(value, "<=") || | 690 identical(value, "<=") || |
| 684 identical(value, "<") || | 691 identical(value, "<") || |
| 685 identical(value, "&") || | 692 identical(value, "&") || |
| 686 identical(value, "^") || | 693 identical(value, "^") || |
| 687 identical(value, "|"); | 694 identical(value, "|"); |
| 688 } | 695 } |
| 689 | 696 |
| 690 bool isTernaryOperator(String value) => identical(value, "[]="); | 697 bool isTernaryOperator(String value) => identical(value, "[]="); |
| 691 | 698 |
| 692 bool isMinusOperator(String value) => identical(value, "-"); | 699 bool isMinusOperator(String value) => identical(value, "-"); |
| OLD | NEW |