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

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

Issue 10544173: Update partial parser and scanner to be able to skip expressions like "new Map<S, T>()". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 token = (begin.endGroup !== null) ? begin.endGroup : token; 47 token = (begin.endGroup !== null) ? begin.endGroup : token;
48 token = token.next; 48 token = token.next;
49 if (token.stringValue === '{') { 49 if (token.stringValue === '{') {
50 begin = token; 50 begin = token;
51 token = (begin.endGroup !== null) ? begin.endGroup : token; 51 token = (begin.endGroup !== null) ? begin.endGroup : token;
52 token = token.next; 52 token = token.next;
53 } 53 }
54 continue; 54 continue;
55 } 55 }
56 } 56 }
57 if (!mayParseFunctionExpressions && value === '{') 57 if (!mayParseFunctionExpressions && value === '{')
Lasse Reichstein Nielsen 2012/06/15 11:51:13 While you are here, please put curly braces around
ahe 2012/06/15 13:12:34 No need. It fits on the previous line.
Lasse Reichstein Nielsen 2012/06/15 13:59:14 I generally prefer to put return statements on a l
ahe 2012/06/19 11:02:42 OK. We have used the "bailout" return can go on th
58 return token; 58 return token;
59 if ((value !== '<') && (token is BeginGroupToken)) { 59 if (token is BeginGroupToken) {
60 BeginGroupToken begin = token; 60 BeginGroupToken begin = token;
61 token = (begin.endGroup !== null) ? begin.endGroup : token; 61 token = (begin.endGroup !== null) ? begin.endGroup : token;
62 } 62 }
63 token = token.next; 63 token = token.next;
64 } 64 }
65 } 65 }
66 66
67 Token skipClassBody(Token token) { 67 Token skipClassBody(Token token) {
68 if (!optional('{', token)) { 68 if (!optional('{', token)) {
69 return listener.expectedClassBodyToSkip(token); 69 return listener.expectedClassBodyToSkip(token);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return token; 101 return token;
102 } 102 }
103 return listener.unexpected(token); 103 return listener.unexpected(token);
104 } 104 }
105 BeginGroupToken beginGroupToken = token; 105 BeginGroupToken beginGroupToken = token;
106 Token endToken = beginGroupToken.endGroup; 106 Token endToken = beginGroupToken.endGroup;
107 listener.endFormalParameters(0, token, endToken); 107 listener.endFormalParameters(0, token, endToken);
108 return endToken.next; 108 return endToken.next;
109 } 109 }
110 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698