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

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

Issue 11014010: Made assert a keyword. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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
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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 } else if (value === 'do') { 1046 } else if (value === 'do') {
1047 return parseDoWhileStatement(token); 1047 return parseDoWhileStatement(token);
1048 } else if (value === 'try') { 1048 } else if (value === 'try') {
1049 return parseTryStatement(token); 1049 return parseTryStatement(token);
1050 } else if (value === 'switch') { 1050 } else if (value === 'switch') {
1051 return parseSwitchStatement(token); 1051 return parseSwitchStatement(token);
1052 } else if (value === 'break') { 1052 } else if (value === 'break') {
1053 return parseBreakStatement(token); 1053 return parseBreakStatement(token);
1054 } else if (value === 'continue') { 1054 } else if (value === 'continue') {
1055 return parseContinueStatement(token); 1055 return parseContinueStatement(token);
1056 } else if (value === 'assert') {
1057 return parseAssertStatement(token);
1056 } else if (value === ';') { 1058 } else if (value === ';') {
1057 return parseEmptyStatement(token); 1059 return parseEmptyStatement(token);
1058 } else if (value === 'const') { 1060 } else if (value === 'const') {
1059 return parseExpressionStatementOrConstDeclaration(token); 1061 return parseExpressionStatementOrConstDeclaration(token);
1060 } else if (token.isIdentifier()) { 1062 } else if (token.isIdentifier()) {
1061 return parseExpressionStatementOrDeclaration(token); 1063 return parseExpressionStatementOrDeclaration(token);
1062 } else { 1064 } else {
1063 return parseExpressionStatement(token); 1065 return parseExpressionStatement(token);
1064 } 1066 }
1065 } 1067 }
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 token = token.next; 2042 token = token.next;
2041 bool hasTarget = false; 2043 bool hasTarget = false;
2042 if (token.isIdentifier()) { 2044 if (token.isIdentifier()) {
2043 token = parseIdentifier(token); 2045 token = parseIdentifier(token);
2044 hasTarget = true; 2046 hasTarget = true;
2045 } 2047 }
2046 listener.handleContinueStatement(hasTarget, continueKeyword, token); 2048 listener.handleContinueStatement(hasTarget, continueKeyword, token);
2047 return expectSemicolon(token); 2049 return expectSemicolon(token);
2048 } 2050 }
2049 2051
2052 Token parseAssertStatement(Token token) {
2053 Token assertKeyword = token;
2054 token = expect('assert', token);
2055 token = parseParenthesizedExpression(token);
ahe 2012/10/10 08:44:13 Rather than parsing a parenthesized expression her
aam-me 2012/10/11 05:35:25 Done.
2056 listener.handleAssertStatement(assertKeyword, token);
2057 return expectSemicolon(token);
2058 }
2059
2050 Token parseEmptyStatement(Token token) { 2060 Token parseEmptyStatement(Token token) {
2051 listener.handleEmptyStatement(token); 2061 listener.handleEmptyStatement(token);
2052 return expectSemicolon(token); 2062 return expectSemicolon(token);
2053 } 2063 }
2054 } 2064 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698