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

Side by Side Diff: pkg/front_end/lib/src/fasta/scanner/utf8_bytes_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.utf8_bytes_scanner; 5 library fasta.scanner.utf8_bytes_scanner;
6 6
7 import 'dart:convert' show UNICODE_BOM_CHARACTER_RUNE, UTF8; 7 import 'dart:convert' show UNICODE_BOM_CHARACTER_RUNE, UTF8;
8 8
9 import '../../scanner/token.dart' show SyntheticStringToken, TokenType; 9 import '../../scanner/token.dart' show SyntheticStringToken, TokenType;
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 analyzer.StringToken createSubstringToken( 203 analyzer.StringToken createSubstringToken(
204 TokenType type, int start, bool asciiOnly, 204 TokenType type, int start, bool asciiOnly,
205 [int extraOffset = 0]) { 205 [int extraOffset = 0]) {
206 return new StringToken.fromUtf8Bytes( 206 return new StringToken.fromUtf8Bytes(
207 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart, 207 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart,
208 precedingComments: comments); 208 precedingComments: comments);
209 } 209 }
210 210
211 @override 211 @override
212 analyzer.StringToken createSyntheticSubstringToken( 212 analyzer.StringToken createSyntheticSubstringToken(
213 TokenType type, int start, bool asciiOnly, String closingQuotes) { 213 TokenType type, int start, bool asciiOnly, String syntheticChars) {
214 String source = StringToken.decodeUtf8(bytes, start, byteOffset, asciiOnly); 214 String source = StringToken.decodeUtf8(bytes, start, byteOffset, asciiOnly);
215 return new SyntheticStringToken( 215 return new SyntheticStringToken(
216 type, source + closingQuotes, tokenStart, source.length); 216 type, source + syntheticChars, tokenStart, source.length);
217 } 217 }
218 218
219 @override 219 @override
220 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly, 220 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly,
221 [int extraOffset = 0]) { 221 [int extraOffset = 0]) {
222 return new CommentToken.fromUtf8Bytes( 222 return new CommentToken.fromUtf8Bytes(
223 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); 223 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart);
224 } 224 }
225 225
226 @override 226 @override
227 DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly, 227 DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly,
228 [int extraOffset = 0]) { 228 [int extraOffset = 0]) {
229 return new DartDocToken.fromUtf8Bytes( 229 return new DartDocToken.fromUtf8Bytes(
230 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); 230 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart);
231 } 231 }
232 232
233 bool atEndOfFile() => byteOffset >= bytes.length - 1; 233 bool atEndOfFile() => byteOffset >= bytes.length - 1;
234 } 234 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/string_scanner.dart ('k') | pkg/front_end/test/scanner_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698