| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |