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

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

Issue 8879052: Add --ast to mini_parser.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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) => skipBlock(token); 8 Token parseClassBody(Token token) => skipBlock(token);
9 9
10 Token fullParseClassBody(Token token) => super.parseClassBody(token); 10 Token fullParseClassBody(Token token) => super.parseClassBody(token);
(...skipping 12 matching lines...) Expand all
23 if ((value !== '<') && (token is BeginGroupToken)) { 23 if ((value !== '<') && (token is BeginGroupToken)) {
24 BeginGroupToken begin = token; 24 BeginGroupToken begin = token;
25 token = (begin.endGroup !== null) ? begin.endGroup : token; 25 token = (begin.endGroup !== null) ? begin.endGroup : token;
26 } 26 }
27 token = token.next; 27 token = token.next;
28 } 28 }
29 } 29 }
30 30
31 Token parseFunctionBody(Token token, bool isExpression) { 31 Token parseFunctionBody(Token token, bool isExpression) {
32 assert(!isExpression); 32 assert(!isExpression);
33 if (optional(';', token)) { 33 String value = token.stringValue;
34 listener.handleNoFunctionBody(token); 34 if (value === ';') {
35 return token; 35 // No body.
36 } else if (optional('=>', token)) { 36 } else if (value === '=>') {
37 token = parseExpression(token.next); 37 token = parseExpression(token.next);
38 expectSemicolon(token); 38 expectSemicolon(token);
39 return token;
40 } else { 39 } else {
41 token = skipBlock(token); 40 token = skipBlock(token);
42 listener.handleNoFunctionBody(token);
43 return token;
44 } 41 }
42 listener.handleNoFunctionBody(token);
ngeoffray 2011/12/09 13:41:27 'handleNoFunctionBody' is kind of weird to call, e
ahe 2011/12/09 14:19:47 I added a comment.
43 return token;
44 }
45
46 Token parseFormalParameters(Token token) => skipFormals(token);
47
48 Token skipFormals(BeginGroupToken token) {
49 listener.beginOptionalFormalParameters(token);
50 expect('(', token);
51 Token endToken = token.endGroup;
52 listener.endFormalParameters(0, token, endToken);
53 return endToken.next;
45 } 54 }
46 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698