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

Side by Side Diff: pkg/analyzer/lib/src/generated/scanner.dart

Issue 745873002: Stop copying tokens in incremental scanner (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean-up Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 engine.scanner; 5 library engine.scanner;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'error.dart'; 9 import 'error.dart';
10 import 'instrumentation.dart'; 10 import 'instrumentation.dart';
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 * can be used as identifiers. 398 * can be used as identifiers.
399 */ 399 */
400 final bool isPseudoKeyword; 400 final bool isPseudoKeyword;
401 401
402 /** 402 /**
403 * Initialize a newly created keyword to have the given [name] and [syntax]. 403 * Initialize a newly created keyword to have the given [name] and [syntax].
404 * The keyword is a pseudo-keyword if the [isPseudoKeyword] flag is `true`. 404 * The keyword is a pseudo-keyword if the [isPseudoKeyword] flag is `true`.
405 */ 405 */
406 const Keyword(this.name, this.syntax, [this.isPseudoKeyword = false]); 406 const Keyword(this.name, this.syntax, [this.isPseudoKeyword = false]);
407 407
408 @override
409 String toString() => name;
410
408 /** 411 /**
409 * Create a table mapping the lexemes of keywords to the corresponding keyword 412 * Create a table mapping the lexemes of keywords to the corresponding keyword
410 * and return the table that was created. 413 * and return the table that was created.
411 */ 414 */
412 static Map<String, Keyword> _createKeywordMap() { 415 static Map<String, Keyword> _createKeywordMap() {
413 LinkedHashMap<String, Keyword> result = 416 LinkedHashMap<String, Keyword> result =
414 new LinkedHashMap<String, Keyword>(); 417 new LinkedHashMap<String, Keyword>();
415 for (Keyword keyword in values) { 418 for (Keyword keyword in values) {
416 result[keyword.syntax] = keyword; 419 result[keyword.syntax] = keyword;
417 } 420 }
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 */ 2185 */
2183 final String name; 2186 final String name;
2184 2187
2185 /** 2188 /**
2186 * The precedence of tokens of this class, or `0` if the such tokens do not 2189 * The precedence of tokens of this class, or `0` if the such tokens do not
2187 * represent an operator. 2190 * represent an operator.
2188 */ 2191 */
2189 final int precedence; 2192 final int precedence;
2190 2193
2191 const TokenClass(this.name, [this.precedence = 0]); 2194 const TokenClass(this.name, [this.precedence = 0]);
2195
2196 @override
2197 String toString() => name;
2192 } 2198 }
2193 2199
2194 /** 2200 /**
2195 * The enumeration `TokenType` defines the types of tokens that can be returned 2201 * The enumeration `TokenType` defines the types of tokens that can be returned
2196 * by the scanner. 2202 * by the scanner.
2197 */ 2203 */
2198 class TokenType { 2204 class TokenType {
2199 /** 2205 /**
2200 * The type of the token that marks the end of the input. 2206 * The type of the token that marks the end of the input.
2201 */ 2207 */
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 identical(lexeme, "<") || 2523 identical(lexeme, "<") ||
2518 identical(lexeme, "&") || 2524 identical(lexeme, "&") ||
2519 identical(lexeme, "^") || 2525 identical(lexeme, "^") ||
2520 identical(lexeme, "|"); 2526 identical(lexeme, "|");
2521 2527
2522 /** 2528 /**
2523 * Return the precedence of the token, or `0` if the token does not represent 2529 * Return the precedence of the token, or `0` if the token does not represent
2524 * an operator. 2530 * an operator.
2525 */ 2531 */
2526 int get precedence => _tokenClass.precedence; 2532 int get precedence => _tokenClass.precedence;
2533
2534 @override
2535 String toString() => name;
2527 } 2536 }
2528 2537
2529 class TokenType_EOF extends TokenType { 2538 class TokenType_EOF extends TokenType {
2530 const TokenType_EOF(String name) : super(name, TokenClass.NO_CLASS, ""); 2539 const TokenType_EOF(String name) : super(name, TokenClass.NO_CLASS, "");
2531 2540
2532 @override 2541 @override
2533 String toString() => "-eof-"; 2542 String toString() => "-eof-";
2534 } 2543 }
2535 2544
2536 /** 2545 /**
(...skipping 12 matching lines...) Expand all
2549 */ 2558 */
2550 TokenWithComment(TokenType type, int offset, this._precedingComment) 2559 TokenWithComment(TokenType type, int offset, this._precedingComment)
2551 : super(type, offset); 2560 : super(type, offset);
2552 2561
2553 @override 2562 @override
2554 Token get precedingComments => _precedingComment; 2563 Token get precedingComments => _precedingComment;
2555 2564
2556 @override 2565 @override
2557 Token copy() => new TokenWithComment(type, offset, _precedingComment); 2566 Token copy() => new TokenWithComment(type, offset, _precedingComment);
2558 } 2567 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698