| 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 if (!isExpression) { | 720 if (!isExpression) { |
| 721 expectSemicolon(token); | 721 expectSemicolon(token); |
| 722 listener.endReturnStatement(true, begin, token); | 722 listener.endReturnStatement(true, begin, token); |
| 723 } else { | 723 } else { |
| 724 listener.endReturnStatement(true, begin, null); | 724 listener.endReturnStatement(true, begin, null); |
| 725 } | 725 } |
| 726 return token; | 726 return token; |
| 727 } | 727 } |
| 728 Token begin = token; | 728 Token begin = token; |
| 729 int statementCount = 0; | 729 int statementCount = 0; |
| 730 listener.beginFunctionBody(begin); | |
| 731 if (!optional('{', token)) { | 730 if (!optional('{', token)) { |
| 732 return listener.expectedFunctionBody(token); | 731 return listener.expectedFunctionBody(token); |
| 733 } else { | |
| 734 token = token.next; | |
| 735 } | 732 } |
| 733 |
| 734 listener.beginFunctionBody(begin); |
| 735 token = token.next; |
| 736 while (notEofOrValue('}', token)) { | 736 while (notEofOrValue('}', token)) { |
| 737 token = parseStatement(token); | 737 token = parseStatement(token); |
| 738 ++statementCount; | 738 ++statementCount; |
| 739 } | 739 } |
| 740 listener.endFunctionBody(statementCount, begin, token); | 740 listener.endFunctionBody(statementCount, begin, token); |
| 741 expect('}', token); | 741 expect('}', token); |
| 742 return token; | 742 return token; |
| 743 } | 743 } |
| 744 | 744 |
| 745 Token parseStatement(Token token) { | 745 Token parseStatement(Token token) { |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 } | 1670 } |
| 1671 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 1671 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 1672 return expectSemicolon(token); | 1672 return expectSemicolon(token); |
| 1673 } | 1673 } |
| 1674 | 1674 |
| 1675 Token parseEmptyStatement(Token token) { | 1675 Token parseEmptyStatement(Token token) { |
| 1676 listener.handleEmptyStatement(token); | 1676 listener.handleEmptyStatement(token); |
| 1677 return expectSemicolon(token); | 1677 return expectSemicolon(token); |
| 1678 } | 1678 } |
| 1679 } | 1679 } |
| OLD | NEW |