| 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 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 } | 2198 } |
| 2198 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2199 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 2199 return expectSemicolon(token); | 2200 return expectSemicolon(token); |
| 2200 } | 2201 } |
| 2201 | 2202 |
| 2202 Token parseEmptyStatement(Token token) { | 2203 Token parseEmptyStatement(Token token) { |
| 2203 listener.handleEmptyStatement(token); | 2204 listener.handleEmptyStatement(token); |
| 2204 return expectSemicolon(token); | 2205 return expectSemicolon(token); |
| 2205 } | 2206 } |
| 2206 } | 2207 } |
| OLD | NEW |