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

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

Issue 10928109: Unbreak the parser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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
« no previous file with comments | « dart/lib/compiler/implementation/scanner/parser.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class PartialParser extends Parser { 5 class PartialParser extends Parser {
6 PartialParser(Listener listener) : super(listener); 6 PartialParser(Listener listener) : super(listener);
7 7
8 Token parseClassBody(Token token) => skipClassBody(token); 8 Token parseClassBody(Token token) => skipClassBody(token);
9 9
10 Token fullParseClassBody(Token token) => super.parseClassBody(token); 10 Token fullParseClassBody(Token token) => super.parseClassBody(token);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 token = token.next; 74 token = token.next;
75 } 75 }
76 } 76 }
77 77
78 Token skipClassBody(Token token) { 78 Token skipClassBody(Token token) {
79 if (!optional('{', token)) { 79 if (!optional('{', token)) {
80 return listener.expectedClassBodyToSkip(token); 80 return listener.expectedClassBodyToSkip(token);
81 } 81 }
82 BeginGroupToken beginGroupToken = token; 82 BeginGroupToken beginGroupToken = token;
83 assert(beginGroupToken.endGroup === null || 83 Token endGroup = beginGroupToken.endGroup;
84 beginGroupToken.endGroup.kind === $CLOSE_CURLY_BRACKET); 84 if (endGroup === null) {
85 return beginGroupToken.endGroup; 85 return listener.unmatched(beginGroupToken);
86 } else if (endGroup.kind !== $CLOSE_CURLY_BRACKET) {
87 return listener.unmatched(beginGroupToken);
88 }
89 return endGroup;
86 } 90 }
87 91
88 Token parseFunctionBody(Token token, bool isExpression) { 92 Token parseFunctionBody(Token token, bool isExpression) {
89 assert(!isExpression); 93 assert(!isExpression);
90 String value = token.stringValue; 94 String value = token.stringValue;
91 if (value === ';') { 95 if (value === ';') {
92 // No body. 96 // No body.
93 } else if (value === '=>') { 97 } else if (value === '=>') {
94 token = parseExpression(token.next); 98 token = parseExpression(token.next);
95 expectSemicolon(token); 99 expectSemicolon(token);
(...skipping 16 matching lines...) Expand all
112 return token; 116 return token;
113 } 117 }
114 return listener.unexpected(token); 118 return listener.unexpected(token);
115 } 119 }
116 BeginGroupToken beginGroupToken = token; 120 BeginGroupToken beginGroupToken = token;
117 Token endToken = beginGroupToken.endGroup; 121 Token endToken = beginGroupToken.endGroup;
118 listener.endFormalParameters(0, token, endToken); 122 listener.endFormalParameters(0, token, endToken);
119 return endToken.next; 123 return endToken.next;
120 } 124 }
121 } 125 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/scanner/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698