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

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

Issue 2666003005: Include characterHex in all encoding errors. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.parser.parser; 5 library fasta.parser.parser;
6 6
7 import '../scanner.dart' show 7 import '../scanner.dart' show
8 ErrorToken; 8 ErrorToken;
9 9
10 import '../scanner/recover.dart' show 10 import '../scanner/recover.dart' show
(...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 } else { 3279 } else {
3280 arguments ??= {}; 3280 arguments ??= {};
3281 listener.handleRecoverableError(token, kind, arguments); 3281 listener.handleRecoverableError(token, kind, arguments);
3282 } 3282 }
3283 } 3283 }
3284 3284
3285 Token reportErrorToken(ErrorToken token, bool isRecoverable) { 3285 Token reportErrorToken(ErrorToken token, bool isRecoverable) {
3286 ErrorKind kind = token.errorCode; 3286 ErrorKind kind = token.errorCode;
3287 Map arguments = const {}; 3287 Map arguments = const {};
3288 switch (kind) { 3288 switch (kind) {
3289 case ErrorKind.AsciiControlCharacter:
3289 case ErrorKind.NonAsciiIdentifier: 3290 case ErrorKind.NonAsciiIdentifier:
3291 case ErrorKind.NonAsciiWhitespace:
3292 case ErrorKind.Encoding:
3290 String hex = token.character.toRadixString(16); 3293 String hex = token.character.toRadixString(16);
3291 if (hex.length < 4) { 3294 if (hex.length < 4) {
3292 String padding = "0000".substring(hex.length); 3295 String padding = "0000".substring(hex.length);
3293 hex = "$padding$hex"; 3296 hex = "$padding$hex";
3294 } 3297 }
3295 arguments = {'characterHex': hex}; 3298 arguments = {'characterHex': hex};
3296 break; 3299 break;
3297 3300
3298 case ErrorKind.UnterminatedString: 3301 case ErrorKind.UnterminatedString:
3299 arguments = {'quote': token.start}; 3302 arguments = {'quote': token.start};
(...skipping 13 matching lines...) Expand all
3313 break; 3316 break;
3314 } 3317 }
3315 if (isRecoverable) { 3318 if (isRecoverable) {
3316 listener.handleRecoverableError(token, kind, arguments); 3319 listener.handleRecoverableError(token, kind, arguments);
3317 return null; 3320 return null;
3318 } else { 3321 } else {
3319 return listener.handleUnrecoverableError(token, kind, arguments); 3322 return listener.handleUnrecoverableError(token, kind, arguments);
3320 } 3323 }
3321 } 3324 }
3322 } 3325 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698