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 part of scanner; | 5 part of scanner; |
6 | 6 |
7 /** | 7 /** |
8 * An event generating parser of Dart programs. This parser expects | 8 * An event generating parser of Dart programs. This parser expects |
9 * all tokens in a linked list (aka a token stream). | 9 * all tokens in a linked list (aka a token stream). |
10 * | 10 * |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 int afterIdKind = afterId.kind; | 1257 int afterIdKind = afterId.kind; |
1258 if (identical(afterIdKind, EQ_TOKEN) || | 1258 if (identical(afterIdKind, EQ_TOKEN) || |
1259 identical(afterIdKind, SEMICOLON_TOKEN) || | 1259 identical(afterIdKind, SEMICOLON_TOKEN) || |
1260 identical(afterIdKind, COMMA_TOKEN)) { | 1260 identical(afterIdKind, COMMA_TOKEN)) { |
1261 // We are looking at "const type identifier" followed by '=', ';', or | 1261 // We are looking at "const type identifier" followed by '=', ';', or |
1262 // ','. | 1262 // ','. |
1263 return parseVariablesDeclaration(token); | 1263 return parseVariablesDeclaration(token); |
1264 } | 1264 } |
1265 // Fall-through to expression statement. | 1265 // Fall-through to expression statement. |
1266 } | 1266 } |
| 1267 |
1267 return parseExpressionStatement(token); | 1268 return parseExpressionStatement(token); |
1268 } | 1269 } |
1269 | 1270 |
1270 Token parseLabel(Token token) { | 1271 Token parseLabel(Token token) { |
1271 token = parseIdentifier(token); | 1272 token = parseIdentifier(token); |
1272 Token colon = token; | 1273 Token colon = token; |
1273 token = expect(':', token); | 1274 token = expect(':', token); |
1274 listener.handleLabel(colon); | 1275 listener.handleLabel(colon); |
1275 return token; | 1276 return token; |
1276 } | 1277 } |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 } | 2168 } |
2168 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2169 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
2169 return expectSemicolon(token); | 2170 return expectSemicolon(token); |
2170 } | 2171 } |
2171 | 2172 |
2172 Token parseEmptyStatement(Token token) { | 2173 Token parseEmptyStatement(Token token) { |
2173 listener.handleEmptyStatement(token); | 2174 listener.handleEmptyStatement(token); |
2174 return expectSemicolon(token); | 2175 return expectSemicolon(token); |
2175 } | 2176 } |
2176 } | 2177 } |
OLD | NEW |