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

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2747803004: Parse assert statements with Fasta. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/listener.dart ('k') | no next file » | 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 library fasta.parser.parser; 5 library fasta.parser.parser;
6 6
7 import '../scanner.dart' show ErrorToken; 7 import '../scanner.dart' show ErrorToken;
8 8
9 import '../scanner/recover.dart' show closeBraceFor, skipToEof; 9 import '../scanner/recover.dart' show closeBraceFor, skipToEof;
10 10
(...skipping 3489 matching lines...) Expand 10 before | Expand all | Expand 10 after
3500 hasTarget = true; 3500 hasTarget = true;
3501 } 3501 }
3502 listener.handleBreakStatement(hasTarget, breakKeyword, token); 3502 listener.handleBreakStatement(hasTarget, breakKeyword, token);
3503 return expectSemicolon(token); 3503 return expectSemicolon(token);
3504 } 3504 }
3505 3505
3506 Token parseAssertStatement(Token token) { 3506 Token parseAssertStatement(Token token) {
3507 Token assertKeyword = token; 3507 Token assertKeyword = token;
3508 Token commaToken = null; 3508 Token commaToken = null;
3509 token = expect('assert', token); 3509 token = expect('assert', token);
3510 Token leftParenthesis = token;
3510 token = expect('(', token); 3511 token = expect('(', token);
3511 bool old = mayParseFunctionExpressions; 3512 bool old = mayParseFunctionExpressions;
3512 mayParseFunctionExpressions = true; 3513 mayParseFunctionExpressions = true;
3513 token = parseExpression(token); 3514 token = parseExpression(token);
3514 if (optional(',', token)) { 3515 if (optional(',', token)) {
3515 commaToken = token; 3516 commaToken = token;
3516 token = token.next; 3517 token = token.next;
3517 token = parseExpression(token); 3518 token = parseExpression(token);
3518 } 3519 }
3520 Token rightParenthesis = token;
3519 token = expect(')', token); 3521 token = expect(')', token);
3520 mayParseFunctionExpressions = old; 3522 mayParseFunctionExpressions = old;
3521 listener.handleAssertStatement(assertKeyword, commaToken, token); 3523 listener.handleAssertStatement(
3524 assertKeyword, leftParenthesis, commaToken, rightParenthesis, token);
3522 return expectSemicolon(token); 3525 return expectSemicolon(token);
3523 } 3526 }
3524 3527
3525 Token parseContinueStatement(Token token) { 3528 Token parseContinueStatement(Token token) {
3526 assert(optional('continue', token)); 3529 assert(optional('continue', token));
3527 Token continueKeyword = token; 3530 Token continueKeyword = token;
3528 token = token.next; 3531 token = token.next;
3529 bool hasTarget = false; 3532 bool hasTarget = false;
3530 if (token.isIdentifier()) { 3533 if (token.isIdentifier()) {
3531 token = parseIdentifier(token, IdentifierContext.labelReference); 3534 token = parseIdentifier(token, IdentifierContext.labelReference);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3597 break; 3600 break;
3598 } 3601 }
3599 if (isRecoverable) { 3602 if (isRecoverable) {
3600 listener.handleRecoverableError(token, kind, arguments); 3603 listener.handleRecoverableError(token, kind, arguments);
3601 return null; 3604 return null;
3602 } else { 3605 } else {
3603 return listener.handleUnrecoverableError(token, kind, arguments); 3606 return listener.handleUnrecoverableError(token, kind, arguments);
3604 } 3607 }
3605 } 3608 }
3606 } 3609 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/listener.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698