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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/scanner/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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 FormalParameterType { 7 class FormalParameterType {
8 final String type; 8 final String type;
9 const FormalParameterType(this.type); 9 const FormalParameterType(this.type);
10 bool get isRequired => this == REQUIRED; 10 bool get isRequired => this == REQUIRED;
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 818
819 Token token = parseIdentifier(name); 819 Token token = parseIdentifier(name);
820 820
821 int fieldCount = 1; 821 int fieldCount = 1;
822 token = parseVariableInitializerOpt(token); 822 token = parseVariableInitializerOpt(token);
823 while (optional(',', token)) { 823 while (optional(',', token)) {
824 token = parseIdentifier(token.next); 824 token = parseIdentifier(token.next);
825 token = parseVariableInitializerOpt(token); 825 token = parseVariableInitializerOpt(token);
826 ++fieldCount; 826 ++fieldCount;
827 } 827 }
828 expectSemicolon(token); 828 Token semicolon = token;
829 token = expectSemicolon(token);
829 if (isTopLevel) { 830 if (isTopLevel) {
830 listener.endTopLevelFields(fieldCount, start, token); 831 listener.endTopLevelFields(fieldCount, start, semicolon);
831 } else { 832 } else {
832 listener.endFields(fieldCount, start, token); 833 listener.endFields(fieldCount, start, semicolon);
833 } 834 }
834 return token.next; 835 return token;
835 } 836 }
836 837
837 Token parseTopLevelMethod(Token start, 838 Token parseTopLevelMethod(Token start,
838 Link<Token> modifiers, 839 Link<Token> modifiers,
839 Token type, 840 Token type,
840 Token getOrSet, 841 Token getOrSet,
841 Token name) { 842 Token name) {
842 Token externalModifier; 843 Token externalModifier;
843 for (Token modifier in modifiers) { 844 for (Token modifier in modifiers) {
844 if (externalModifier == null && optional('external', modifier)) { 845 if (externalModifier == null && optional('external', modifier)) {
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2445 } 2446 }
2446 listener.handleContinueStatement(hasTarget, continueKeyword, token); 2447 listener.handleContinueStatement(hasTarget, continueKeyword, token);
2447 return expectSemicolon(token); 2448 return expectSemicolon(token);
2448 } 2449 }
2449 2450
2450 Token parseEmptyStatement(Token token) { 2451 Token parseEmptyStatement(Token token) {
2451 listener.handleEmptyStatement(token); 2452 listener.handleEmptyStatement(token);
2452 return expectSemicolon(token); 2453 return expectSemicolon(token);
2453 } 2454 }
2454 } 2455 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698