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

Unified Diff: dart/frog/leg/scanner/array_based_scanner.dart

Issue 9129015: Diagnose unterminated "grouping" characters. (Closed) Base URL: ssh://aaricia.aar/home/ahe/Dart/all/dart.googlecode.com.git@master
Patch Set: Update mini_parser Created 8 years, 11 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 | « no previous file | dart/frog/leg/scanner/scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/scanner/array_based_scanner.dart
diff --git a/dart/frog/leg/scanner/array_based_scanner.dart b/dart/frog/leg/scanner/array_based_scanner.dart
index 1a49c2e118c39e623a697673b4df15e5c068c27b..ff6ac88e15decc142c852987fce0c4469017a8a8 100644
--- a/dart/frog/leg/scanner/array_based_scanner.dart
+++ b/dart/frog/leg/scanner/array_based_scanner.dart
@@ -12,7 +12,7 @@ class ArrayBasedScanner<S> extends AbstractScanner<S> {
/** Since the input is UTF8, some characters are represented by more
* than one byte. [extraCharOffset] tracks the difference. */
int extraCharOffset;
- Link<Token> groupingStack = const EmptyLink<Token>();
+ Link<BeginGroupToken> groupingStack = const EmptyLink<BeginGroupToken>();
ArrayBasedScanner()
: this.extraCharOffset = 0,
@@ -58,6 +58,11 @@ class ArrayBasedScanner<S> extends AbstractScanner<S> {
tail = tail.next;
// EOF points to itself so there's always infinite look-ahead.
tail.next = tail;
+ if (!groupingStack.isEmpty()) {
+ BeginGroupToken begin = groupingStack.head;
+ throw new MalformedInputException('Unbalanced ${begin.stringValue}',
+ begin);
+ }
}
void beginToken() {
@@ -100,7 +105,8 @@ class ArrayBasedScanner<S> extends AbstractScanner<S> {
if (openKind !== OPEN_CURLY_BRACKET_TOKEN ||
begin.kind !== STRING_INTERPOLATION_TOKEN) {
// Not ending string interpolation.
- throw new MalformedInputException('Unmatched ${begin.stringValue}');
+ throw new MalformedInputException('Unmatched ${begin.stringValue}',
+ begin);
}
// We're ending an interpolated expression.
begin.endGroup = tail;
« no previous file with comments | « no previous file | dart/frog/leg/scanner/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698