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

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

Issue 8497042: Allow error-recovery in top-level nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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 | « dart/frog/leg/scanner/node_scanner_bench.dart ('k') | dart/frog/leg/scanner/scanner_bench.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/scanner/parser.dart
diff --git a/dart/frog/leg/scanner/parser.dart b/dart/frog/leg/scanner/parser.dart
index b276a970ce9003ee0f1544c93313e62e40485f48..506107eecbd4e21c7ad0ff4ac7c1f4e0d71ca120 100644
--- a/dart/frog/leg/scanner/parser.dart
+++ b/dart/frog/leg/scanner/parser.dart
@@ -305,13 +305,19 @@ class Parser<L extends Listener> {
}
token = parseIdentifier(previous);
bool isField;
- if (optional('(', token)) {
- isField = false;
- } else if (optional('=', token) || optional(';', token)) {
- isField = true;
- } else {
- token = listener.unexpected(token);
- }
+ do {
kasperl 2011/11/09 12:59:18 Why do you prefer do { } while (true) over while (
ahe 2011/11/09 13:07:55 No particular reason. I was thinking about writing
+ // Loop to allow the listener to rewrite the token stream to
+ // make the parser happy.
+ if (optional('(', token)) {
+ isField = false;
+ break;
+ } else if (optional('=', token) || optional(';', token)) {
+ isField = true;
+ break;
+ } else {
+ token = listener.unexpected(token);
+ }
+ } while (true);
while (token !== null &&
token.kind !== LBRACE_TOKEN &&
token.kind !== SEMICOLON_TOKEN) {
« no previous file with comments | « dart/frog/leg/scanner/node_scanner_bench.dart ('k') | dart/frog/leg/scanner/scanner_bench.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698