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

Unified Diff: pkg/front_end/lib/src/scanner/errors.dart

Issue 2778213002: Use message.yaml in parser. (Closed)
Patch Set: Update subpackage relationships. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/stack_listener.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/scanner/errors.dart
diff --git a/pkg/front_end/lib/src/scanner/errors.dart b/pkg/front_end/lib/src/scanner/errors.dart
index 3a8483fae17d0b8cf20fbb65632f04f4d9de67cd..6374f842b4c8c8ee59d508741b7362dea113d408 100644
--- a/pkg/front_end/lib/src/scanner/errors.dart
+++ b/pkg/front_end/lib/src/scanner/errors.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:front_end/src/base/errors.dart';
+import 'package:front_end/src/fasta/fasta_codes.dart';
import 'package:front_end/src/fasta/scanner/error_token.dart';
import 'package:front_end/src/fasta/scanner/token.dart';
import 'package:front_end/src/fasta/scanner/token_constants.dart';
@@ -89,35 +90,39 @@ void translateErrorToken(ErrorToken token, ReportError reportError) {
}
var errorCode = token.errorCode;
- switch (errorCode) {
- case ErrorKind.UnterminatedString:
+ switch (errorCode.analyzerCode) {
+ case "UNTERMINATED_STRING_LITERAL":
// TODO(paulberry,ahe): Fasta reports the error location as the entire
// string; analyzer expects the end of the string.
charOffset = endOffset;
return _makeError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, null);
- case ErrorKind.UnmatchedToken:
- return null;
- case ErrorKind.UnterminatedComment:
+
+ case "UNTERMINATED_MULTI_LINE_COMMENT":
// TODO(paulberry,ahe): Fasta reports the error location as the entire
// comment; analyzer expects the end of the comment.
charOffset = endOffset;
return _makeError(ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT, null);
- case ErrorKind.MissingExponent:
+
+ case "MISSING_DIGIT":
// TODO(paulberry,ahe): Fasta reports the error location as the entire
// number; analyzer expects the end of the number.
charOffset = endOffset - 1;
return _makeError(ScannerErrorCode.MISSING_DIGIT, null);
- case ErrorKind.ExpectedHexDigit:
+
+ case "MISSING_HEX_DIGIT":
// TODO(paulberry,ahe): Fasta reports the error location as the entire
// number; analyzer expects the end of the number.
charOffset = endOffset - 1;
return _makeError(ScannerErrorCode.MISSING_HEX_DIGIT, null);
- case ErrorKind.NonAsciiIdentifier:
- case ErrorKind.NonAsciiWhitespace:
+
+ case "ILLEGAL_CHARACTER":
return _makeError(ScannerErrorCode.ILLEGAL_CHARACTER, [token.character]);
- case ErrorKind.UnexpectedDollarInString:
- return null;
+
default:
+ if (errorCode == codeUnmatchedToken ||
+ errorCode == codeUnexpectedDollarInString) {
+ return null;
+ }
throw new UnimplementedError('$errorCode');
}
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/stack_listener.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698