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

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

Issue 10968067: Allow external top-level getters and setters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | « no previous file | dart/lib/isolate/base.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 (aka a token stream). 7 * all tokens in a linked list (aka a token stream).
8 * 8 *
9 * The class [Scanner] is used to generate a token stream. See the 9 * The class [Scanner] is used to generate a token stream. See the
10 * file scanner.dart. 10 * file scanner.dart.
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 token = parseIdentifier(name); 551 token = parseIdentifier(name);
552 552
553 bool isField; 553 bool isField;
554 while (true) { 554 while (true) {
555 // Loop to allow the listener to rewrite the token stream for 555 // Loop to allow the listener to rewrite the token stream for
556 // error handling. 556 // error handling.
557 final String value = token.stringValue; 557 final String value = token.stringValue;
558 if ((value === '(') || (value === '{') || (value === '=>')) { 558 if ((value === '(') || (value === '{') || (value === '=>')) {
559 isField = false; 559 isField = false;
560 break; 560 break;
561 } else if ((value === '=') || (value === ';') || (value === ',')) { 561 } else if ((value === '=') || (value === ',')) {
562 isField = true; 562 isField = true;
563 break; 563 break;
564 } else if (value === ';') {
565 if (getOrSet != null) {
566 // If we found a "get" keyword, this must be an abstract
567 // getter.
568 isField = (getOrSet.stringValue !== 'get');
569 // TODO(ahe): This feels like a hack.
570 } else {
571 isField = true;
572 }
573 break;
564 } else { 574 } else {
565 token = listener.unexpected(token); 575 token = listener.unexpected(token);
566 if (token.kind === EOF_TOKEN) { 576 if (token.kind === EOF_TOKEN) {
567 // TODO(ahe): This is a hack. It would be better to tell the 577 // TODO(ahe): This is a hack. It would be better to tell the
568 // listener more explicitly that it must pop an identifier. 578 // listener more explicitly that it must pop an identifier.
569 listener.endTopLevelFields(1, start, token); 579 listener.endTopLevelFields(1, start, token);
570 return token; 580 return token;
571 } 581 }
572 } 582 }
573 } 583 }
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 } 2047 }
2038 listener.handleContinueStatement(hasTarget, continueKeyword, token); 2048 listener.handleContinueStatement(hasTarget, continueKeyword, token);
2039 return expectSemicolon(token); 2049 return expectSemicolon(token);
2040 } 2050 }
2041 2051
2042 Token parseEmptyStatement(Token token) { 2052 Token parseEmptyStatement(Token token) {
2043 listener.handleEmptyStatement(token); 2053 listener.handleEmptyStatement(token);
2044 return expectSemicolon(token); 2054 return expectSemicolon(token);
2045 } 2055 }
2046 } 2056 }
OLDNEW
« no previous file with comments | « no previous file | dart/lib/isolate/base.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698