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

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

Issue 9027002: Support factory methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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 /** 5 /**
6 * An event generating parser of Dart programs. This parser expects 6 * An event generating parser of Dart programs. This parser expects
7 * all tokens in a linked list. 7 * all tokens in a linked list.
8 */ 8 */
9 class Parser { 9 class Parser {
10 final Listener listener; 10 final Listener listener;
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 listener.handleQualified(period); 564 listener.handleQualified(period);
565 } 565 }
566 token = parseTypeVariablesOpt(token); 566 token = parseTypeVariablesOpt(token);
567 Token period = null; 567 Token period = null;
568 if (optional('.', token)) { 568 if (optional('.', token)) {
569 period = token; 569 period = token;
570 token = parseIdentifier(token.next); 570 token = parseIdentifier(token.next);
571 } 571 }
572 token = parseFormalParameters(token); 572 token = parseFormalParameters(token);
573 token = parseFunctionBody(token, false); 573 token = parseFunctionBody(token, false);
574 listener.endFactoryMethod(factoryKeyword, period); 574 listener.endFactoryMethod(factoryKeyword, period, token);
575 return token.next; 575 return token.next;
576 } 576 }
577 577
578 Token parseOperatorName(Token token) { 578 Token parseOperatorName(Token token) {
579 assert(optional('operator', token)); 579 assert(optional('operator', token));
580 Token operator = token; 580 Token operator = token;
581 token = token.next; 581 token = token.next;
582 // TODO(ahe): Validate that [token] really is an operator. 582 // TODO(ahe): Validate that [token] really is an operator.
583 listener.handleOperatorName(operator, token); 583 listener.handleOperatorName(operator, token);
584 return token.next; 584 return token.next;
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 } 1399 }
1400 listener.handleContinueStatement(hasTarget, continueKeyword, token); 1400 listener.handleContinueStatement(hasTarget, continueKeyword, token);
1401 return expectSemicolon(token); 1401 return expectSemicolon(token);
1402 } 1402 }
1403 1403
1404 Token parseEmptyStatement(Token token) { 1404 Token parseEmptyStatement(Token token) {
1405 listener.handleEmptyStatement(token); 1405 listener.handleEmptyStatement(token);
1406 return expectSemicolon(token); 1406 return expectSemicolon(token);
1407 } 1407 }
1408 } 1408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698