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

Side by Side Diff: dart/frog/leg/scanner/partial_parser.dart

Issue 9663047: Repeated prefixes and parser fixes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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 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);
11 11
12 Token parseExpression(Token token) => skipExpression(token); 12 Token parseExpression(Token token) => skipExpression(token);
13 13
14 Token skipExpression(Token token) { 14 Token skipExpression(Token token) {
15 while (true) { 15 while (true) {
16 final kind = token.kind; 16 final kind = token.kind;
17 final value = token.stringValue; 17 final value = token.stringValue;
18 if ((kind === EOF_TOKEN) || 18 if ((kind === EOF_TOKEN) ||
19 (value === ';') || 19 (value === ';') ||
20 (value === ',') || 20 (value === ',') ||
21 (value === ']')) 21 (value === ']'))
22 return token; 22 return token;
23 if (value === '=' && token.next.stringValue === '{') {
ahe 2012/03/10 23:07:18 I should add a comment explaining this covers this
ahe 2012/03/11 13:01:50 Done.
24 BeginGroupToken begin = token.next;
25 token = (begin.endGroup !== null) ? begin.endGroup : token;
26 token = token.next;
27 continue;
28 }
23 if (!mayParseFunctionExpressions && value === '{') 29 if (!mayParseFunctionExpressions && value === '{')
24 return token; 30 return token;
25 if ((value !== '<') && (token is BeginGroupToken)) { 31 if ((value !== '<') && (token is BeginGroupToken)) {
26 BeginGroupToken begin = token; 32 BeginGroupToken begin = token;
27 token = (begin.endGroup !== null) ? begin.endGroup : token; 33 token = (begin.endGroup !== null) ? begin.endGroup : token;
28 } 34 }
29 token = token.next; 35 token = token.next;
30 } 36 }
31 } 37 }
32 38
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return token; 73 return token;
68 } 74 }
69 return listener.unexpected(token); 75 return listener.unexpected(token);
70 } 76 }
71 BeginGroupToken beginGroupToken = token; 77 BeginGroupToken beginGroupToken = token;
72 Token endToken = beginGroupToken.endGroup; 78 Token endToken = beginGroupToken.endGroup;
73 listener.endFormalParameters(0, token, endToken); 79 listener.endFormalParameters(0, token, endToken);
74 return endToken.next; 80 return endToken.next;
75 } 81 }
76 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698