| OLD | NEW |
| 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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 } else if (value === 'do') { | 1142 } else if (value === 'do') { |
| 1143 return parseDoWhileStatement(token); | 1143 return parseDoWhileStatement(token); |
| 1144 } else if (value === 'try') { | 1144 } else if (value === 'try') { |
| 1145 return parseTryStatement(token); | 1145 return parseTryStatement(token); |
| 1146 } else if (value === 'switch') { | 1146 } else if (value === 'switch') { |
| 1147 return parseSwitchStatement(token); | 1147 return parseSwitchStatement(token); |
| 1148 } else if (value === 'break') { | 1148 } else if (value === 'break') { |
| 1149 return parseBreakStatement(token); | 1149 return parseBreakStatement(token); |
| 1150 } else if (value === 'continue') { | 1150 } else if (value === 'continue') { |
| 1151 return parseContinueStatement(token); | 1151 return parseContinueStatement(token); |
| 1152 } else if (value === 'assert') { |
| 1153 return parseAssertStatement(token); |
| 1152 } else if (value === ';') { | 1154 } else if (value === ';') { |
| 1153 return parseEmptyStatement(token); | 1155 return parseEmptyStatement(token); |
| 1154 } else if (value === 'const') { | 1156 } else if (value === 'const') { |
| 1155 return parseExpressionStatementOrConstDeclaration(token); | 1157 return parseExpressionStatementOrConstDeclaration(token); |
| 1156 } else if (token.isIdentifier()) { | 1158 } else if (token.isIdentifier()) { |
| 1157 return parseExpressionStatementOrDeclaration(token); | 1159 return parseExpressionStatementOrDeclaration(token); |
| 1158 } else { | 1160 } else { |
| 1159 return parseExpressionStatement(token); | 1161 return parseExpressionStatement(token); |
| 1160 } | 1162 } |
| 1161 } | 1163 } |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 token = token.next; | 2125 token = token.next; |
| 2124 bool hasTarget = false; | 2126 bool hasTarget = false; |
| 2125 if (token.isIdentifier()) { | 2127 if (token.isIdentifier()) { |
| 2126 token = parseIdentifier(token); | 2128 token = parseIdentifier(token); |
| 2127 hasTarget = true; | 2129 hasTarget = true; |
| 2128 } | 2130 } |
| 2129 listener.handleBreakStatement(hasTarget, breakKeyword, token); | 2131 listener.handleBreakStatement(hasTarget, breakKeyword, token); |
| 2130 return expectSemicolon(token); | 2132 return expectSemicolon(token); |
| 2131 } | 2133 } |
| 2132 | 2134 |
| 2135 Token parseAssertStatement(Token token) { |
| 2136 Token assertKeyword = token; |
| 2137 token = expect('assert', token); |
| 2138 token = parseArguments(token); |
| 2139 listener.handleAssertStatement(assertKeyword, token); |
| 2140 return expectSemicolon(token); |
| 2141 } |
| 2142 |
| 2133 Token parseContinueStatement(Token token) { | 2143 Token parseContinueStatement(Token token) { |
| 2134 assert(optional('continue', token)); | 2144 assert(optional('continue', token)); |
| 2135 Token continueKeyword = token; | 2145 Token continueKeyword = token; |
| 2136 token = token.next; | 2146 token = token.next; |
| 2137 bool hasTarget = false; | 2147 bool hasTarget = false; |
| 2138 if (token.isIdentifier()) { | 2148 if (token.isIdentifier()) { |
| 2139 token = parseIdentifier(token); | 2149 token = parseIdentifier(token); |
| 2140 hasTarget = true; | 2150 hasTarget = true; |
| 2141 } | 2151 } |
| 2142 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2152 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 2143 return expectSemicolon(token); | 2153 return expectSemicolon(token); |
| 2144 } | 2154 } |
| 2145 | 2155 |
| 2146 Token parseEmptyStatement(Token token) { | 2156 Token parseEmptyStatement(Token token) { |
| 2147 listener.handleEmptyStatement(token); | 2157 listener.handleEmptyStatement(token); |
| 2148 return expectSemicolon(token); | 2158 return expectSemicolon(token); |
| 2149 } | 2159 } |
| 2150 } | 2160 } |
| OLD | NEW |