| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 return true; | 257 return true; |
| 258 } | 258 } |
| 259 return false; | 259 return false; |
| 260 } | 260 } |
| 261 | 261 |
| 262 Token skipBlock(Token token) { | 262 Token skipBlock(Token token) { |
| 263 if (!optional('{', token)) { | 263 if (!optional('{', token)) { |
| 264 return listener.expectedBlockToSkip(token); | 264 return listener.expectedBlockToSkip(token); |
| 265 } | 265 } |
| 266 BeginGroupToken beginGroupToken = token; | 266 BeginGroupToken beginGroupToken = token; |
| 267 assert(beginGroupToken.endGroup === null || | 267 Token endGroup = beginGroupToken.endGroup; |
| 268 beginGroupToken.endGroup.kind === $CLOSE_CURLY_BRACKET); | 268 if (endGroup === null) { |
| 269 return listener.unmatched(beginGroupToken); |
| 270 } else if (endGroup.kind !== $CLOSE_CURLY_BRACKET) { |
| 271 return listener.unmatched(beginGroupToken); |
| 272 } |
| 269 return beginGroupToken.endGroup; | 273 return beginGroupToken.endGroup; |
| 270 } | 274 } |
| 271 | 275 |
| 272 Token parseClass(Token token) { | 276 Token parseClass(Token token) { |
| 273 Token begin = token; | 277 Token begin = token; |
| 274 listener.beginClassDeclaration(token); | 278 listener.beginClassDeclaration(token); |
| 275 if (optional('abstract', token)) { | 279 if (optional('abstract', token)) { |
| 276 // TODO(ahe): Notify listener about abstract modifier. | 280 // TODO(ahe): Notify listener about abstract modifier. |
| 277 token = token.next; | 281 token = token.next; |
| 278 } | 282 } |
| (...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 } | 1930 } |
| 1927 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 1931 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 1928 return expectSemicolon(token); | 1932 return expectSemicolon(token); |
| 1929 } | 1933 } |
| 1930 | 1934 |
| 1931 Token parseEmptyStatement(Token token) { | 1935 Token parseEmptyStatement(Token token) { |
| 1932 listener.handleEmptyStatement(token); | 1936 listener.handleEmptyStatement(token); |
| 1933 return expectSemicolon(token); | 1937 return expectSemicolon(token); |
| 1934 } | 1938 } |
| 1935 } | 1939 } |
| OLD | NEW |