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

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

Issue 2797353002: Revert "enhance analyzer to parse uppercase and built-in/pseudo keywords" (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « pkg/front_end/lib/src/scanner/scanner.dart ('k') | pkg/front_end/test/token_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /** 5 /**
6 * Defines the tokens that are produced by the scanner, used by the parser, and 6 * Defines the tokens that are produced by the scanner, used by the parser, and
7 * referenced from the [AST structure](ast.dart). 7 * referenced from the [AST structure](ast.dart).
8 */ 8 */
9 import 'dart:collection'; 9 import 'dart:collection';
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 * 149 *
150 * Clients may not extend, implement or mix-in this class. 150 * Clients may not extend, implement or mix-in this class.
151 */ 151 */
152 abstract class Keyword { 152 abstract class Keyword {
153 static const Keyword ABSTRACT = fasta.Keyword.ABSTRACT; 153 static const Keyword ABSTRACT = fasta.Keyword.ABSTRACT;
154 154
155 static const Keyword AS = fasta.Keyword.AS; 155 static const Keyword AS = fasta.Keyword.AS;
156 156
157 static const Keyword ASSERT = fasta.Keyword.ASSERT; 157 static const Keyword ASSERT = fasta.Keyword.ASSERT;
158 158
159 static const Keyword ASYNC = fasta.Keyword.ASYNC;
160
161 static const Keyword AWAIT = fasta.Keyword.AWAIT;
162
163 static const Keyword BREAK = fasta.Keyword.BREAK; 159 static const Keyword BREAK = fasta.Keyword.BREAK;
164 160
165 static const Keyword CASE = fasta.Keyword.CASE; 161 static const Keyword CASE = fasta.Keyword.CASE;
166 162
167 static const Keyword CATCH = fasta.Keyword.CATCH; 163 static const Keyword CATCH = fasta.Keyword.CATCH;
168 164
169 static const Keyword CLASS = fasta.Keyword.CLASS; 165 static const Keyword CLASS = fasta.Keyword.CLASS;
170 166
171 static const Keyword CONST = fasta.Keyword.CONST; 167 static const Keyword CONST = fasta.Keyword.CONST;
172 168
(...skipping 22 matching lines...) Expand all
195 static const Keyword FACTORY = fasta.Keyword.FACTORY; 191 static const Keyword FACTORY = fasta.Keyword.FACTORY;
196 192
197 static const Keyword FALSE = fasta.Keyword.FALSE; 193 static const Keyword FALSE = fasta.Keyword.FALSE;
198 194
199 static const Keyword FINAL = fasta.Keyword.FINAL; 195 static const Keyword FINAL = fasta.Keyword.FINAL;
200 196
201 static const Keyword FINALLY = fasta.Keyword.FINALLY; 197 static const Keyword FINALLY = fasta.Keyword.FINALLY;
202 198
203 static const Keyword FOR = fasta.Keyword.FOR; 199 static const Keyword FOR = fasta.Keyword.FOR;
204 200
205 static const Keyword FUNCTION = fasta.Keyword.FUNCTION;
206
207 static const Keyword GET = fasta.Keyword.GET; 201 static const Keyword GET = fasta.Keyword.GET;
208 202
209 static const Keyword HIDE = fasta.Keyword.HIDE;
210
211 static const Keyword IF = fasta.Keyword.IF; 203 static const Keyword IF = fasta.Keyword.IF;
212 204
213 static const Keyword IMPLEMENTS = fasta.Keyword.IMPLEMENTS; 205 static const Keyword IMPLEMENTS = fasta.Keyword.IMPLEMENTS;
214 206
215 static const Keyword IMPORT = fasta.Keyword.IMPORT; 207 static const Keyword IMPORT = fasta.Keyword.IMPORT;
216 208
217 static const Keyword IN = fasta.Keyword.IN; 209 static const Keyword IN = fasta.Keyword.IN;
218 210
219 static const Keyword IS = fasta.Keyword.IS; 211 static const Keyword IS = fasta.Keyword.IS;
220 212
221 static const Keyword LIBRARY = fasta.Keyword.LIBRARY; 213 static const Keyword LIBRARY = fasta.Keyword.LIBRARY;
222 214
223 static const Keyword NATIVE = fasta.Keyword.NATIVE;
224
225 static const Keyword NEW = fasta.Keyword.NEW; 215 static const Keyword NEW = fasta.Keyword.NEW;
226 216
227 static const Keyword NULL = fasta.Keyword.NULL; 217 static const Keyword NULL = fasta.Keyword.NULL;
228 218
229 static const Keyword OF = fasta.Keyword.OF;
230
231 static const Keyword ON = fasta.Keyword.ON;
232
233 static const Keyword OPERATOR = fasta.Keyword.OPERATOR; 219 static const Keyword OPERATOR = fasta.Keyword.OPERATOR;
234 220
235 static const Keyword PART = fasta.Keyword.PART; 221 static const Keyword PART = fasta.Keyword.PART;
236 222
237 static const Keyword PATCH = fasta.Keyword.PATCH;
238
239 static const Keyword RETHROW = fasta.Keyword.RETHROW; 223 static const Keyword RETHROW = fasta.Keyword.RETHROW;
240 224
241 static const Keyword RETURN = fasta.Keyword.RETURN; 225 static const Keyword RETURN = fasta.Keyword.RETURN;
242 226
243 static const Keyword SET = fasta.Keyword.SET; 227 static const Keyword SET = fasta.Keyword.SET;
244 228
245 static const Keyword SHOW = fasta.Keyword.SHOW;
246
247 static const Keyword SOURCE = fasta.Keyword.SOURCE;
248
249 static const Keyword STATIC = fasta.Keyword.STATIC; 229 static const Keyword STATIC = fasta.Keyword.STATIC;
250 230
251 static const Keyword SUPER = fasta.Keyword.SUPER; 231 static const Keyword SUPER = fasta.Keyword.SUPER;
252 232
253 static const Keyword SWITCH = fasta.Keyword.SWITCH; 233 static const Keyword SWITCH = fasta.Keyword.SWITCH;
254 234
255 static const Keyword SYNC = fasta.Keyword.SYNC;
256
257 static const Keyword THIS = fasta.Keyword.THIS; 235 static const Keyword THIS = fasta.Keyword.THIS;
258 236
259 static const Keyword THROW = fasta.Keyword.THROW; 237 static const Keyword THROW = fasta.Keyword.THROW;
260 238
261 static const Keyword TRUE = fasta.Keyword.TRUE; 239 static const Keyword TRUE = fasta.Keyword.TRUE;
262 240
263 static const Keyword TRY = fasta.Keyword.TRY; 241 static const Keyword TRY = fasta.Keyword.TRY;
264 242
265 static const Keyword TYPEDEF = fasta.Keyword.TYPEDEF; 243 static const Keyword TYPEDEF = fasta.Keyword.TYPEDEF;
266 244
267 static const Keyword VAR = fasta.Keyword.VAR; 245 static const Keyword VAR = fasta.Keyword.VAR;
268 246
269 static const Keyword VOID = fasta.Keyword.VOID; 247 static const Keyword VOID = fasta.Keyword.VOID;
270 248
271 static const Keyword WHILE = fasta.Keyword.WHILE; 249 static const Keyword WHILE = fasta.Keyword.WHILE;
272 250
273 static const Keyword WITH = fasta.Keyword.WITH; 251 static const Keyword WITH = fasta.Keyword.WITH;
274 252
275 static const Keyword YIELD = fasta.Keyword.YIELD;
276
277 static const List<Keyword> values = const <Keyword>[ 253 static const List<Keyword> values = const <Keyword>[
278 ABSTRACT, 254 ABSTRACT,
279 AS, 255 AS,
280 ASSERT, 256 ASSERT,
281 ASYNC,
282 AWAIT,
283 BREAK, 257 BREAK,
284 CASE, 258 CASE,
285 CATCH, 259 CATCH,
286 CLASS, 260 CLASS,
287 CONST, 261 CONST,
288 CONTINUE, 262 CONTINUE,
289 COVARIANT, 263 COVARIANT,
290 DEFAULT, 264 DEFAULT,
291 DEFERRED, 265 DEFERRED,
292 DO, 266 DO,
293 DYNAMIC, 267 DYNAMIC,
294 ELSE, 268 ELSE,
295 ENUM, 269 ENUM,
296 EXPORT, 270 EXPORT,
297 EXTENDS, 271 EXTENDS,
298 EXTERNAL, 272 EXTERNAL,
299 FACTORY, 273 FACTORY,
300 FALSE, 274 FALSE,
301 FINAL, 275 FINAL,
302 FINALLY, 276 FINALLY,
303 FOR, 277 FOR,
304 FUNCTION,
305 GET, 278 GET,
306 HIDE,
307 IF, 279 IF,
308 IMPLEMENTS, 280 IMPLEMENTS,
309 IMPORT, 281 IMPORT,
310 IN, 282 IN,
311 IS, 283 IS,
312 LIBRARY, 284 LIBRARY,
313 NATIVE,
314 NEW, 285 NEW,
315 NULL, 286 NULL,
316 OF,
317 ON,
318 OPERATOR, 287 OPERATOR,
319 PART, 288 PART,
320 PATCH,
321 RETHROW, 289 RETHROW,
322 RETURN, 290 RETURN,
323 SET, 291 SET,
324 SHOW,
325 SOURCE,
326 STATIC, 292 STATIC,
327 SUPER, 293 SUPER,
328 SWITCH, 294 SWITCH,
329 SYNC,
330 THIS, 295 THIS,
331 THROW, 296 THROW,
332 TRUE, 297 TRUE,
333 TRY, 298 TRY,
334 TYPEDEF, 299 TYPEDEF,
335 VAR, 300 VAR,
336 VOID, 301 VOID,
337 WHILE, 302 WHILE,
338 WITH, 303 WITH,
339 YIELD,
340 ]; 304 ];
341 305
342 /** 306 /**
343 * A table mapping the lexemes of keywords to the corresponding keyword. 307 * A table mapping the lexemes of keywords to the corresponding keyword.
344 */ 308 */
345 static final Map<String, Keyword> keywords = _createKeywordMap(); 309 static final Map<String, Keyword> keywords = _createKeywordMap();
346 310
347 final fasta.PrecedenceInfo info; 311 final fasta.PrecedenceInfo info;
348 312
349 /** 313 /**
(...skipping 13 matching lines...) Expand all
363 final String syntax; 327 final String syntax;
364 328
365 /** 329 /**
366 * Initialize a newly created keyword. 330 * Initialize a newly created keyword.
367 */ 331 */
368 const Keyword(this.syntax, 332 const Keyword(this.syntax,
369 {this.isBuiltIn: false, 333 {this.isBuiltIn: false,
370 this.isPseudo: false, 334 this.isPseudo: false,
371 this.info: fasta.KEYWORD_INFO}); 335 this.info: fasta.KEYWORD_INFO});
372 336
373 bool get isBuiltInOrPseudo => isBuiltIn || isPseudo;
374
375 /** 337 /**
376 * A flag indicating whether the keyword is "built-in" identifier. 338 * A flag indicating whether the keyword is "built-in" identifier.
377 * This method exists for backward compatibility and will be removed. 339 * This method exists for backward compatibility and will be removed.
378 * Use [isBuiltIn] instead. 340 * Use [isBuiltIn] instead.
379 */ 341 */
380 @deprecated 342 @deprecated
381 bool get isPseudoKeyword => isBuiltIn; // TODO (danrubel): remove this 343 bool get isPseudoKeyword => isBuiltIn; // TODO (danrubel): remove this
382 344
383 /** 345 /**
384 * The name of the keyword type. 346 * The name of the keyword type.
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 1216
1255 void set precedingComments(CommentToken comment) { 1217 void set precedingComments(CommentToken comment) {
1256 _precedingComment = comment; 1218 _precedingComment = comment;
1257 _setCommentParent(_precedingComment); 1219 _setCommentParent(_precedingComment);
1258 } 1220 }
1259 1221
1260 @override 1222 @override
1261 Token copy() => 1223 Token copy() =>
1262 new TokenWithComment(type, offset, copyComments(precedingComments)); 1224 new TokenWithComment(type, offset, copyComments(precedingComments));
1263 } 1225 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/scanner/scanner.dart ('k') | pkg/front_end/test/token_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698