| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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. | 7 * all tokens in a linked list. |
| 8 */ | 8 */ |
| 9 class Parser { | 9 class Parser { |
| 10 final Listener listener; | 10 final Listener listener; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 switch (token.value) { | 27 switch (token.value) { |
| 28 case Keyword.INTERFACE: | 28 case Keyword.INTERFACE: |
| 29 token = parseInterface(token); | 29 token = parseInterface(token); |
| 30 break; | 30 break; |
| 31 case Keyword.CLASS: | 31 case Keyword.CLASS: |
| 32 token = parseClass(token); | 32 token = parseClass(token); |
| 33 break; | 33 break; |
| 34 case Keyword.TYPEDEF: | 34 case Keyword.TYPEDEF: |
| 35 token = parseNamedFunctionAlias(token); | 35 token = parseNamedFunctionAlias(token); |
| 36 break; | 36 break; |
| 37 case const SourceString("#"): | |
| 38 token = parseLibraryTags(token); | |
| 39 break; | |
| 40 default: | 37 default: |
| 41 token = parseTopLevelMember(token); | 38 // TODO(ahe): Work around frog switch bug #314. |
| 39 if (token.value == const SourceString("#")) { |
| 40 token = parseLibraryTags(token); |
| 41 } else { |
| 42 token = parseTopLevelMember(token); |
| 43 } |
| 42 break; | 44 break; |
| 43 } | 45 } |
| 44 } | 46 } |
| 45 } | 47 } |
| 46 | 48 |
| 47 Token parseInterface(Token token) { | 49 Token parseInterface(Token token) { |
| 48 listener.beginInterface(token); | 50 listener.beginInterface(token); |
| 49 token = parseIdentifier(next(token)); | 51 token = parseIdentifier(next(token)); |
| 50 token = parseTypeVariablesOpt(token); | 52 token = parseTypeVariablesOpt(token); |
| 51 token = parseSupertypesClauseOpt(token); | 53 token = parseSupertypesClauseOpt(token); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 576 } |
| 575 | 577 |
| 576 Token parseBlock(Token token) { | 578 Token parseBlock(Token token) { |
| 577 token = expect(const SourceString('{'), token); | 579 token = expect(const SourceString('{'), token); |
| 578 while (!optional(const SourceString("}"), token)) { | 580 while (!optional(const SourceString("}"), token)) { |
| 579 token = parseStatement(token); | 581 token = parseStatement(token); |
| 580 } | 582 } |
| 581 return expect(const SourceString("}"), token); | 583 return expect(const SourceString("}"), token); |
| 582 } | 584 } |
| 583 } | 585 } |
| OLD | NEW |