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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 token = parseIdentifier(token.next); | 718 token = parseIdentifier(token.next); |
719 } | 719 } |
720 token = parseFormalParameters(token); | 720 token = parseFormalParameters(token); |
721 token = parseFunctionBody(token, false); | 721 token = parseFunctionBody(token, false); |
722 listener.endFactoryMethod(start, period, token); | 722 listener.endFactoryMethod(start, period, token); |
723 return token.next; | 723 return token.next; |
724 } | 724 } |
725 | 725 |
726 Token parseOperatorName(Token token) { | 726 Token parseOperatorName(Token token) { |
727 assert(optional('operator', token)); | 727 assert(optional('operator', token)); |
728 if (isUserDefinableOperator(token.next.stringValue)) { | 728 if (isUserDefinableOperator(token.next.stringValue) |
| 729 // TODO(ahe): Remove negate. |
| 730 || token.next.value == const SourceString("negate")) { |
729 Token operator = token; | 731 Token operator = token; |
730 token = token.next; | 732 token = token.next; |
731 listener.handleOperatorName(operator, token); | 733 listener.handleOperatorName(operator, token); |
732 return token.next; | 734 return token.next; |
733 } else { | 735 } else { |
734 return parseIdentifier(token); | 736 return parseIdentifier(token); |
735 } | 737 } |
736 } | 738 } |
737 | 739 |
738 Token parseFunction(Token token, Token getOrSet) { | 740 Token parseFunction(Token token, Token getOrSet) { |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 } | 1840 } |
1839 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 1841 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
1840 return expectSemicolon(token); | 1842 return expectSemicolon(token); |
1841 } | 1843 } |
1842 | 1844 |
1843 Token parseEmptyStatement(Token token) { | 1845 Token parseEmptyStatement(Token token) { |
1844 listener.handleEmptyStatement(token); | 1846 listener.handleEmptyStatement(token); |
1845 return expectSemicolon(token); | 1847 return expectSemicolon(token); |
1846 } | 1848 } |
1847 } | 1849 } |
OLD | NEW |