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

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

Issue 3002493002: generate synthetic and error tokens when missing digit (Closed)
Patch Set: rebase Created 3 years, 4 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.array_based_scanner; 5 library fasta.scanner.array_based_scanner;
6 6
7 import 'error_token.dart' show ErrorToken, UnmatchedToken; 7 import 'error_token.dart' show ErrorToken, UnmatchedToken;
8 8
9 import '../../scanner/token.dart' 9 import '../../scanner/token.dart'
10 show 10 show
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 @override 257 @override
258 void appendSubstringToken(TokenType type, int start, bool asciiOnly, 258 void appendSubstringToken(TokenType type, int start, bool asciiOnly,
259 [int extraOffset = 0]) { 259 [int extraOffset = 0]) {
260 appendToken(createSubstringToken(type, start, asciiOnly, extraOffset)); 260 appendToken(createSubstringToken(type, start, asciiOnly, extraOffset));
261 } 261 }
262 262
263 @override 263 @override
264 void appendSyntheticSubstringToken( 264 void appendSyntheticSubstringToken(
265 TokenType type, int start, bool asciiOnly, String closingQuotes) { 265 TokenType type, int start, bool asciiOnly, String syntheticChars) {
266 appendToken( 266 appendToken(
267 createSyntheticSubstringToken(type, start, asciiOnly, closingQuotes)); 267 createSyntheticSubstringToken(type, start, asciiOnly, syntheticChars));
268 } 268 }
269 269
270 /** 270 /**
271 * Returns a new substring from the scan offset [start] to the current 271 * Returns a new substring from the scan offset [start] to the current
272 * [scanOffset] plus the [extraOffset]. For example, if the current 272 * [scanOffset] plus the [extraOffset]. For example, if the current
273 * scanOffset is 10, then [appendSubstringToken(5, -1)] will append the 273 * scanOffset is 10, then [appendSubstringToken(5, -1)] will append the
274 * substring string [5,9). 274 * substring string [5,9).
275 * 275 *
276 * Note that [extraOffset] can only be used if the covered character(s) are 276 * Note that [extraOffset] can only be used if the covered character(s) are
277 * known to be ASCII. 277 * known to be ASCII.
278 */ 278 */
279 analyzer.StringToken createSubstringToken( 279 analyzer.StringToken createSubstringToken(
280 TokenType type, int start, bool asciiOnly, 280 TokenType type, int start, bool asciiOnly,
281 [int extraOffset = 0]); 281 [int extraOffset = 0]);
282 282
283 /** 283 /**
284 * Returns a new synthetic substring from the scan offset [start] 284 * Returns a new synthetic substring from the scan offset [start]
285 * to the current [scanOffset] plus the [closingQuotes]. 285 * to the current [scanOffset] plus the [syntheticChars].
286 * The [closingQuotes] are appended to the unterminated string 286 * The [syntheticChars] are appended to the unterminated string
287 * literal's lexeme but the returned token's length will *not* include 287 * literal's lexeme but the returned token's length will *not* include
288 * those closing quotes so as to be true to the original source. 288 * those additional characters so as to be true to the original source.
289 */ 289 */
290 analyzer.StringToken createSyntheticSubstringToken( 290 analyzer.StringToken createSyntheticSubstringToken(
291 TokenType type, int start, bool asciiOnly, String closingQuotes); 291 TokenType type, int start, bool asciiOnly, String syntheticChars);
292 292
293 /** 293 /**
294 * This method is called to discard '<' from the "grouping" stack. 294 * This method is called to discard '<' from the "grouping" stack.
295 * 295 *
296 * [PartialParser.skipExpression] relies on the fact that we do not 296 * [PartialParser.skipExpression] relies on the fact that we do not
297 * create groups for stuff like: 297 * create groups for stuff like:
298 * [:a = b < c, d = e > f:]. 298 * [:a = b < c, d = e > f:].
299 * 299 *
300 * In other words, this method is called when the scanner recognizes 300 * In other words, this method is called when the scanner recognizes
301 * something which cannot possibly be part of a type parameter/argument 301 * something which cannot possibly be part of a type parameter/argument
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // | 367 // |
368 // next 368 // next
369 // v 369 // v
370 // EOF 370 // EOF
371 TokenType type = closeBraceInfoFor(begin); 371 TokenType type = closeBraceInfoFor(begin);
372 appendToken(new SyntheticToken(type, tokenStart)); 372 appendToken(new SyntheticToken(type, tokenStart));
373 begin.endGroup = tail; 373 begin.endGroup = tail;
374 appendErrorToken(new UnmatchedToken(begin)); 374 appendErrorToken(new UnmatchedToken(begin));
375 } 375 }
376 } 376 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart ('k') | pkg/front_end/lib/src/fasta/scanner/string_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698