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

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

Issue 9663047: Repeated prefixes and parser fixes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased and status file Created 8 years, 9 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/frog/leg/scanner/partial_parser.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) 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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 Token parseVariablesDeclarationOrExpressionOpt(Token token) { 1371 Token parseVariablesDeclarationOrExpressionOpt(Token token) {
1372 final String value = token.stringValue; 1372 final String value = token.stringValue;
1373 if (value === ';') { 1373 if (value === ';') {
1374 listener.handleNoExpression(token); 1374 listener.handleNoExpression(token);
1375 return token; 1375 return token;
1376 } else if ((value === 'var') || (value === 'final')) { 1376 } else if ((value === 'var') || (value === 'final')) {
1377 return parseVariablesDeclarationNoSemicolon(token); 1377 return parseVariablesDeclarationNoSemicolon(token);
1378 } 1378 }
1379 Token identifier = peekIdentifierAfterType(token); 1379 Token identifier = peekIdentifierAfterType(token);
1380 if (identifier !== null) { 1380 if (identifier !== null) {
1381 assert(identifier.kind === IDENTIFIER_TOKEN); 1381 assert(isIdentifier(identifier));
1382 Token afterId = identifier.next; 1382 Token afterId = identifier.next;
1383 int afterIdKind = afterId.kind; 1383 int afterIdKind = afterId.kind;
1384 if (afterIdKind === EQ_TOKEN || afterIdKind === SEMICOLON_TOKEN || 1384 if (afterIdKind === EQ_TOKEN || afterIdKind === SEMICOLON_TOKEN ||
1385 afterIdKind === COMMA_TOKEN || optional('in', afterId)) { 1385 afterIdKind === COMMA_TOKEN || optional('in', afterId)) {
1386 return parseVariablesDeclarationNoSemicolon(token); 1386 return parseVariablesDeclarationNoSemicolon(token);
1387 } 1387 }
1388 } 1388 }
1389 return parseExpression(token); 1389 return parseExpression(token);
1390 } 1390 }
1391 1391
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 } 1625 }
1626 listener.handleContinueStatement(hasTarget, continueKeyword, token); 1626 listener.handleContinueStatement(hasTarget, continueKeyword, token);
1627 return expectSemicolon(token); 1627 return expectSemicolon(token);
1628 } 1628 }
1629 1629
1630 Token parseEmptyStatement(Token token) { 1630 Token parseEmptyStatement(Token token) {
1631 listener.handleEmptyStatement(token); 1631 listener.handleEmptyStatement(token);
1632 return expectSemicolon(token); 1632 return expectSemicolon(token);
1633 } 1633 }
1634 } 1634 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/listener.dart ('k') | dart/frog/leg/scanner/partial_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698