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

Unified Diff: pkg/front_end/lib/src/fasta/parser/listener.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/parser/error_kind.dart ('k') | pkg/front_end/lib/src/fasta/parser/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/parser/listener.dart
diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart
index 9f54a87c6185aedcdd0c54d1e3f14c51e390656b..612f4d7449da01a5d59a85a4e843da8e6e64ace7 100644
--- a/pkg/front_end/lib/src/fasta/parser/listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/listener.dart
@@ -4,11 +4,12 @@
library fasta.parser.listener;
+import '../fasta_codes.dart' show FastaMessage;
+
import '../scanner/token.dart' show BeginGroupToken, SymbolToken, Token;
import '../util/link.dart' show Link;
-import 'error_kind.dart' show ErrorKind;
import 'package:front_end/src/fasta/scanner/precedence.dart' show RECOVERY_INFO;
import 'parser.dart' show FormalParameterType;
@@ -28,6 +29,8 @@ import 'identifier_context.dart' show IdentifierContext;
class Listener {
final List<ParserError> recoverableErrors = <ParserError>[];
+ Uri get uri => null;
+
void logEvent(String name) {}
set suppressParseErrors(bool value) {}
@@ -1006,14 +1009,13 @@ class Listener {
/// `null`. In the latter case, the parser simply skips to EOF which will
/// often result in additional parser errors as the parser returns from its
/// recursive state.
- Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) {
- throw new ParserError.fromTokens(token, token, kind, arguments);
+ Token handleUnrecoverableError(Token token, FastaMessage message) {
+ throw new ParserError.fromTokens(token, token, message);
}
/// The parser noticed a syntax error, but was able to recover from it.
- void handleRecoverableError(Token token, ErrorKind kind, Map arguments) {
- recoverableErrors
- .add(new ParserError.fromTokens(token, token, kind, arguments));
+ void handleRecoverableError(Token token, FastaMessage message) {
+ recoverableErrors.add(new ParserError.fromTokens(token, token, message));
}
void handleScript(Token token) {
@@ -1036,14 +1038,12 @@ class ParserError {
/// Character offset from the beginning of file where this error ends.
final int endOffset;
- final ErrorKind kind;
-
- final Map arguments;
+ final FastaMessage message;
- ParserError(this.beginOffset, this.endOffset, this.kind, this.arguments);
+ ParserError(this.beginOffset, this.endOffset, this.message);
- ParserError.fromTokens(Token begin, Token end, ErrorKind kind, Map arguments)
- : this(begin.charOffset, end.charOffset + end.charCount, kind, arguments);
+ ParserError.fromTokens(Token begin, Token end, FastaMessage message)
+ : this(begin.charOffset, end.charOffset + end.charCount, message);
- String toString() => "@${beginOffset}: $kind $arguments";
+ String toString() => "@${beginOffset}: ${message.message}\n${message.tip}";
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/error_kind.dart ('k') | pkg/front_end/lib/src/fasta/parser/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698