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

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

Issue 2794653002: fasta tokens implement analyzer token API (Closed)
Patch Set: merge 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
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 import 'package:charcode/ascii.dart'; 5 import 'package:charcode/ascii.dart';
6 import 'package:front_end/src/scanner/errors.dart'; 6 import 'package:front_end/src/scanner/errors.dart';
7 import 'package:front_end/src/scanner/reader.dart'; 7 import 'package:front_end/src/scanner/reader.dart';
8 import 'package:front_end/src/scanner/string_utilities.dart'; 8 import 'package:front_end/src/scanner/string_utilities.dart';
9 import 'package:front_end/src/scanner/token.dart'; 9 import 'package:front_end/src/scanner/token.dart';
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * 119 *
120 * The lexical structure of Dart is ambiguous without knowledge of the context 120 * The lexical structure of Dart is ambiguous without knowledge of the context
121 * in which a token is being scanned. For example, without context we cannot 121 * in which a token is being scanned. For example, without context we cannot
122 * determine whether source of the form "<<" should be scanned as a single 122 * determine whether source of the form "<<" should be scanned as a single
123 * left-shift operator or as two left angle brackets. This scanner does not have 123 * left-shift operator or as two left angle brackets. This scanner does not have
124 * any context, so it always resolves such conflicts by scanning the longest 124 * any context, so it always resolves such conflicts by scanning the longest
125 * possible token. 125 * possible token.
126 */ 126 */
127 abstract class Scanner { 127 abstract class Scanner {
128 /** 128 /**
129 * A flag indicating whether the [Scanner] factory method
130 * will return a fasta based scanner or an analyzer based scanner.
131 */
132 static bool useFasta = false;
133
134 /**
129 * The reader used to access the characters in the source. 135 * The reader used to access the characters in the source.
130 */ 136 */
131 final CharacterReader _reader; 137 final CharacterReader _reader;
132 138
133 /** 139 /**
134 * The flag specifying whether documentation comments should be parsed. 140 * The flag specifying whether documentation comments should be parsed.
135 */ 141 */
136 bool _preserveComments = true; 142 bool _preserveComments = true;
137 143
138 /** 144 /**
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 } 1338 }
1333 1339
1334 /** 1340 /**
1335 * Checks if [value] is a single-line or multi-line comment. 1341 * Checks if [value] is a single-line or multi-line comment.
1336 */ 1342 */
1337 static bool _isDocumentationComment(String value) { 1343 static bool _isDocumentationComment(String value) {
1338 return StringUtilities.startsWith3(value, 0, $slash, $slash, $slash) || 1344 return StringUtilities.startsWith3(value, 0, $slash, $slash, $slash) ||
1339 StringUtilities.startsWith3(value, 0, $slash, $asterisk, $asterisk); 1345 StringUtilities.startsWith3(value, 0, $slash, $asterisk, $asterisk);
1340 } 1346 }
1341 } 1347 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/token.dart ('k') | pkg/front_end/lib/src/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698