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

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

Issue 2750863002: Complain about built-in identifiers. (Closed)
Patch Set: Update status file some more. 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 '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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return 1; 116 return 1;
117 } else { 117 } else {
118 return lexeme.length; 118 return lexeme.length;
119 } 119 }
120 } 120 }
121 121
122 /// The character offset of the end of this token within the source text. 122 /// The character offset of the end of this token within the source text.
123 int get charEnd => charOffset + charCount; 123 int get charEnd => charOffset + charCount;
124 124
125 bool get isEof => false; 125 bool get isEof => false;
126
127 bool get isBuiltInIdentifier => false;
126 } 128 }
127 129
128 /** 130 /**
129 * A [SymbolToken] represents the symbol in its precedence info. 131 * A [SymbolToken] represents the symbol in its precedence info.
130 * Also used for end of file with EOF_INFO. 132 * Also used for end of file with EOF_INFO.
131 */ 133 */
132 class SymbolToken extends Token { 134 class SymbolToken extends Token {
133 final PrecedenceInfo info; 135 final PrecedenceInfo info;
134 136
135 SymbolToken(this.info, int charOffset) : super(charOffset); 137 SymbolToken(this.info, int charOffset) : super(charOffset);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 KeywordToken(this.keyword, int charOffset) : super(charOffset); 169 KeywordToken(this.keyword, int charOffset) : super(charOffset);
168 170
169 PrecedenceInfo get info => keyword.info; 171 PrecedenceInfo get info => keyword.info;
170 172
171 String get lexeme => keyword.syntax; 173 String get lexeme => keyword.syntax;
172 174
173 String get stringValue => keyword.syntax; 175 String get stringValue => keyword.syntax;
174 176
175 bool isIdentifier() => keyword.isPseudo || keyword.isBuiltIn; 177 bool isIdentifier() => keyword.isPseudo || keyword.isBuiltIn;
176 178
179 bool get isBuiltInIdentifier {
180 // TODO(ahe): Remove special case for "deferred" once dartbug.com/29069 is
181 // fixed.
182 return keyword.isBuiltIn || identical("deferred", lexeme);
183 }
184
177 String toString() => "KeywordToken($lexeme)"; 185 String toString() => "KeywordToken($lexeme)";
178 } 186 }
179 187
180 /** 188 /**
181 * A String-valued token. Represents identifiers, string literals, 189 * A String-valued token. Represents identifiers, string literals,
182 * number literals, comments, and error tokens, using the corresponding 190 * number literals, comments, and error tokens, using the corresponding
183 * precedence info. 191 * precedence info.
184 */ 192 */
185 class StringToken extends Token { 193 class StringToken extends Token {
186 /** 194 /**
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 identical(value, "<=") || 376 identical(value, "<=") ||
369 identical(value, "<") || 377 identical(value, "<") ||
370 identical(value, "&") || 378 identical(value, "&") ||
371 identical(value, "^") || 379 identical(value, "^") ||
372 identical(value, "|"); 380 identical(value, "|");
373 } 381 }
374 382
375 bool isTernaryOperator(String value) => identical(value, "[]="); 383 bool isTernaryOperator(String value) => identical(value, "[]=");
376 384
377 bool isMinusOperator(String value) => identical(value, "-"); 385 bool isMinusOperator(String value) => identical(value, "-");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698