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

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

Issue 9117033: Setup getter and setter elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 11 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/frog/leg/scanner/listener.dart ('k') | dart/tests/language/language-leg.status » ('j') | 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 /** 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 if (token.kind === EOF_TOKEN) { 594 if (token.kind === EOF_TOKEN) {
595 // TODO(ahe): This is a hack, see parseTopLevelMember. 595 // TODO(ahe): This is a hack, see parseTopLevelMember.
596 listener.endFields(1, start, token); 596 listener.endFields(1, start, token);
597 return token; 597 return token;
598 } 598 }
599 } 599 }
600 } 600 }
601 if (isField) { 601 if (isField) {
602 int fieldCount = 1; 602 int fieldCount = 1;
603 token = parseVariableInitializerOpt(token); 603 token = parseVariableInitializerOpt(token);
604 if (getOrSet !== null) {
605 listener.recoverableError("unexpected", token: getOrSet);
606 }
604 while (optional(',', token)) { 607 while (optional(',', token)) {
605 // TODO(ahe): Count these. 608 // TODO(ahe): Count these.
606 token = parseIdentifier(token.next); 609 token = parseIdentifier(token.next);
607 token = parseVariableInitializerOpt(token); 610 token = parseVariableInitializerOpt(token);
608 ++fieldCount; 611 ++fieldCount;
609 } 612 }
610 expectSemicolon(token); 613 expectSemicolon(token);
611 listener.endFields(fieldCount, start, token); 614 listener.endFields(fieldCount, start, token);
612 } else { 615 } else {
613 token = parseQualifiedRestOpt(token); 616 token = parseQualifiedRestOpt(token);
614 token = parseFormalParameters(token); 617 token = parseFormalParameters(token);
615 token = parseInitializersOpt(token); 618 token = parseInitializersOpt(token);
616 token = parseFunctionBody(token, false); 619 token = parseFunctionBody(token, false);
617 listener.endMethod(start, token); 620 listener.endMethod(getOrSet, start, token);
618 } 621 }
619 return token.next; 622 return token.next;
620 } 623 }
621 624
622 Token parseFactoryMethod(Token token) { 625 Token parseFactoryMethod(Token token) {
623 assert(optional('factory', token)); 626 assert(optional('factory', token));
624 Token factoryKeyword = token; 627 Token factoryKeyword = token;
625 listener.beginFactoryMethod(factoryKeyword); 628 listener.beginFactoryMethod(factoryKeyword);
626 token = token.next; // Skip 'factory'. 629 token = token.next; // Skip 'factory'.
627 token = parseIdentifier(token); 630 token = parseIdentifier(token);
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 } 1591 }
1589 listener.handleContinueStatement(hasTarget, continueKeyword, token); 1592 listener.handleContinueStatement(hasTarget, continueKeyword, token);
1590 return expectSemicolon(token); 1593 return expectSemicolon(token);
1591 } 1594 }
1592 1595
1593 Token parseEmptyStatement(Token token) { 1596 Token parseEmptyStatement(Token token) {
1594 listener.handleEmptyStatement(token); 1597 listener.handleEmptyStatement(token);
1595 return expectSemicolon(token); 1598 return expectSemicolon(token);
1596 } 1599 }
1597 } 1600 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/listener.dart ('k') | dart/tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698