| Index: dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
|
| diff --git a/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart b/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
|
| index 762bd81ac40c6f2a712f606f9469ea1d291a5eac..5bb67901b6da46bac291dbdff3f55c5a84b59ad5 100644
|
| --- a/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
|
| +++ b/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
|
| @@ -719,12 +719,27 @@ class Listener {
|
| break;
|
| }
|
| reportError(token, kind, arguments);
|
| + } else if (token is UnmatchedToken) {
|
| + String begin = token.begin.value;
|
| + String end = closeBraceFor(begin);
|
| + reportError(
|
| + token, MessageKind.UNMATCHED_TOKEN, {'begin': begin, 'end': end});
|
| } else {
|
| throw new SpannableAssertionFailure(token, token.assertionMessage);
|
| }
|
| }
|
| }
|
|
|
| +String closeBraceFor(String openBrace) {
|
| + return const {
|
| + '(': ')',
|
| + '[': ']',
|
| + '{': '}',
|
| + '<': '>',
|
| + r'${': '}',
|
| + }[openBrace];
|
| +}
|
| +
|
| class ParserError {
|
| final String reason;
|
| ParserError(this.reason);
|
| @@ -1160,10 +1175,16 @@ class ElementListener extends Listener {
|
| if (token is ErrorToken) {
|
| reportErrorToken(token);
|
| } else {
|
| - reportFatalError(token,
|
| - "Unmatched '${token.value}'.");
|
| + String begin = token.value;
|
| + String end = closeBraceFor(begin);
|
| + reportError(
|
| + token, MessageKind.UNMATCHED_TOKEN, {'begin': begin, 'end': end});
|
| }
|
| - return skipToEof(token);
|
| + Token next = token.next;
|
| + while (next is ErrorToken) {
|
| + next = next.next;
|
| + }
|
| + return next;
|
| }
|
|
|
| void recoverableError(Spannable node, String message) {
|
|
|