| 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 20 matching lines...) Expand all Loading... |
| 31 final Listener listener; | 31 final Listener listener; |
| 32 bool mayParseFunctionExpressions = true; | 32 bool mayParseFunctionExpressions = true; |
| 33 | 33 |
| 34 Parser(this.listener); | 34 Parser(this.listener); |
| 35 | 35 |
| 36 Token parseUnit(Token token) { | 36 Token parseUnit(Token token) { |
| 37 listener.beginCompilationUnit(token); | 37 listener.beginCompilationUnit(token); |
| 38 int count = 0; | 38 int count = 0; |
| 39 while (!identical(token.kind, EOF_TOKEN)) { | 39 while (!identical(token.kind, EOF_TOKEN)) { |
| 40 token = parseTopLevelDeclaration(token); | 40 token = parseTopLevelDeclaration(token); |
| 41 listener.endTopLevelDeclaration(token); |
| 41 count++; | 42 count++; |
| 42 } | 43 } |
| 43 listener.endCompilationUnit(count, token); | 44 listener.endCompilationUnit(count, token); |
| 44 return token; | 45 return token; |
| 45 } | 46 } |
| 46 | 47 |
| 47 Token parseTopLevelDeclaration(Token token) { | 48 Token parseTopLevelDeclaration(Token token) { |
| 48 token = parseMetadataStar(token); | 49 token = parseMetadataStar(token); |
| 49 final String value = token.stringValue; | 50 final String value = token.stringValue; |
| 50 if (identical(value, 'interface')) { | 51 if (identical(value, 'interface')) { |
| (...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2221 } | 2222 } |
| 2222 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2223 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 2223 return expectSemicolon(token); | 2224 return expectSemicolon(token); |
| 2224 } | 2225 } |
| 2225 | 2226 |
| 2226 Token parseEmptyStatement(Token token) { | 2227 Token parseEmptyStatement(Token token) { |
| 2227 listener.handleEmptyStatement(token); | 2228 listener.handleEmptyStatement(token); |
| 2228 return expectSemicolon(token); | 2229 return expectSemicolon(token); |
| 2229 } | 2230 } |
| 2230 } | 2231 } |
| OLD | NEW |