Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: pkg/front_end/lib/src/fasta/scanner/token.dart

Issue 2758113002: fasta.PrecedenceInfo implement analyzer.TokenType (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
8
7 import 'keyword.dart' show Keyword; 9 import 'keyword.dart' show Keyword;
8 10
9 import 'precedence.dart' show BAD_INPUT_INFO, EOF_INFO, PrecedenceInfo; 11 import 'precedence.dart' show BAD_INPUT_INFO, EOF_INFO, PrecedenceInfo;
10 12
11 import 'token_constants.dart' show IDENTIFIER_TOKEN; 13 import 'token_constants.dart' show IDENTIFIER_TOKEN;
12 14
13 import 'string_canonicalizer.dart'; 15 import 'string_canonicalizer.dart';
14 16
15 /** 17 /**
16 * A token that doubles as a linked list. 18 * A token that doubles as a linked list.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } else { 121 } else {
120 return lexeme.length; 122 return lexeme.length;
121 } 123 }
122 } 124 }
123 125
124 /// The character offset of the end of this token within the source text. 126 /// The character offset of the end of this token within the source text.
125 int get charEnd => charOffset + charCount; 127 int get charEnd => charOffset + charCount;
126 128
127 bool get isEof => false; 129 bool get isEof => false;
128 130
131 bool get isBuiltInIdentifier => false;
132
129 bool get isOperator => info.isOperator; 133 bool get isOperator => info.isOperator;
130 134
131 bool get isBuiltInIdentifier => false; 135 bool get isUserDefinableOperator => info.isUserDefinableOperator;
ahe 2017/03/20 12:25:29 @override?
danrubel 2017/03/20 17:19:30 I can't add that until fasta.Token implements anal
136
137 analyzer.TokenType get type => info;
138
139 int get offset => charOffset;
132 } 140 }
133 141
134 /** 142 /**
135 * A [SymbolToken] represents the symbol in its precedence info. 143 * A [SymbolToken] represents the symbol in its precedence info.
136 * Also used for end of file with EOF_INFO. 144 * Also used for end of file with EOF_INFO.
137 */ 145 */
138 class SymbolToken extends Token { 146 class SymbolToken extends Token {
139 final PrecedenceInfo info; 147 final PrecedenceInfo info;
140 148
141 SymbolToken(this.info, int charOffset) : super(charOffset); 149 SymbolToken(this.info, int charOffset) : super(charOffset);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 identical(value, "<=") || 390 identical(value, "<=") ||
383 identical(value, "<") || 391 identical(value, "<") ||
384 identical(value, "&") || 392 identical(value, "&") ||
385 identical(value, "^") || 393 identical(value, "^") ||
386 identical(value, "|"); 394 identical(value, "|");
387 } 395 }
388 396
389 bool isTernaryOperator(String value) => identical(value, "[]="); 397 bool isTernaryOperator(String value) => identical(value, "[]=");
390 398
391 bool isMinusOperator(String value) => identical(value, "-"); 399 bool isMinusOperator(String value) => identical(value, "-");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698