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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart

Issue 324293002: Improve parser error recovery. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Johnni's comments Created 6 years, 6 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 part of scanner; 5 part of scanner;
6 6
7 class PartialParser extends Parser { 7 class PartialParser extends Parser {
8 PartialParser(Listener listener) : super(listener); 8 PartialParser(Listener listener) : super(listener);
9 9
10 Token parseClassBody(Token token) => skipClassBody(token); 10 Token parseClassBody(Token token) => skipClassBody(token);
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 } 26 }
27 27
28 Token skipExpression(Token token) { 28 Token skipExpression(Token token) {
29 while (true) { 29 while (true) {
30 final kind = token.kind; 30 final kind = token.kind;
31 final value = token.stringValue; 31 final value = token.stringValue;
32 if ((identical(kind, EOF_TOKEN)) || 32 if ((identical(kind, EOF_TOKEN)) ||
33 (identical(value, ';')) || 33 (identical(value, ';')) ||
34 (identical(value, ',')) || 34 (identical(value, ',')) ||
35 (identical(value, '}')) ||
36 (identical(value, ')')) ||
35 (identical(value, ']'))) { 37 (identical(value, ']'))) {
36 break; 38 break;
37 } 39 }
38 if (identical(value, '=') || 40 if (identical(value, '=') ||
39 identical(value, '?') || 41 identical(value, '?') ||
40 identical(value, ':')) { 42 identical(value, ':')) {
41 var nextValue = token.next.stringValue; 43 var nextValue = token.next.stringValue;
42 if (identical(nextValue, 'const')) { 44 if (identical(nextValue, 'const')) {
43 token = token.next; 45 token = token.next;
44 nextValue = token.next.stringValue; 46 nextValue = token.next.stringValue;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return token; 136 return token;
135 } 137 }
136 return listener.unexpected(token); 138 return listener.unexpected(token);
137 } 139 }
138 BeginGroupToken beginGroupToken = token; 140 BeginGroupToken beginGroupToken = token;
139 Token endToken = beginGroupToken.endGroup; 141 Token endToken = beginGroupToken.endGroup;
140 listener.endFormalParameters(0, token, endToken); 142 listener.endFormalParameters(0, token, endToken);
141 return endToken.next; 143 return endToken.next;
142 } 144 }
143 } 145 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698