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

Side by Side Diff: dart/lib/compiler/implementation/scanner/array_based_scanner.dart

Issue 11092101: Diagnose unbalanced parentheses better. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 abstract 5 abstract
6 class ArrayBasedScanner<S extends SourceString> extends AbstractScanner<S> { 6 class ArrayBasedScanner<S extends SourceString> extends AbstractScanner<S> {
7 int get charOffset => byteOffset + extraCharOffset; 7 int get charOffset => byteOffset + extraCharOffset;
8 final Token tokens; 8 final Token tokens;
9 Token tail; 9 Token tail;
10 int tokenStart; 10 int tokenStart;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 tail = tail.next; 59 tail = tail.next;
60 } 60 }
61 61
62 void appendEofToken() { 62 void appendEofToken() {
63 tail.next = new Token(EOF_INFO, charOffset); 63 tail.next = new Token(EOF_INFO, charOffset);
64 tail = tail.next; 64 tail = tail.next;
65 // EOF points to itself so there's always infinite look-ahead. 65 // EOF points to itself so there's always infinite look-ahead.
66 tail.next = tail; 66 tail.next = tail;
67 discardOpenLt(); 67 discardOpenLt();
68 while (!groupingStack.isEmpty()) { 68 while (!groupingStack.isEmpty()) {
69 BeginGroupToken begin = groupingStack.head; 69 unmatchedBeginGroup(groupingStack.head);
70 begin.endGroup = tail;
71 groupingStack = groupingStack.tail; 70 groupingStack = groupingStack.tail;
72 } 71 }
73 } 72 }
74 73
75 void beginToken() { 74 void beginToken() {
76 tokenStart = charOffset; 75 tokenStart = charOffset;
77 } 76 }
78 77
79 Token firstToken() { 78 Token firstToken() {
80 return tokens.next; 79 return tokens.next;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 172
174 void discardOpenLt() { 173 void discardOpenLt() {
175 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { 174 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) {
176 groupingStack = groupingStack.tail; 175 groupingStack = groupingStack.tail;
177 } 176 }
178 } 177 }
179 178
180 // TODO(ahe): make class abstract instead of adding an abstract method. 179 // TODO(ahe): make class abstract instead of adding an abstract method.
181 abstract peek(); 180 abstract peek();
182 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698