| OLD | NEW |
| 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.parser; | 5 package com.google.dart.compiler.parser; |
| 6 | 6 |
| 7 import com.google.common.annotations.VisibleForTesting; | 7 import com.google.common.annotations.VisibleForTesting; |
| 8 import com.google.common.io.CharStreams; | 8 import com.google.common.io.CharStreams; |
| 9 import com.google.dart.compiler.DartCompilationError; | 9 import com.google.dart.compiler.DartCompilationError; |
| 10 import com.google.dart.compiler.DartCompilerListener; | 10 import com.google.dart.compiler.DartCompilerListener; |
| 11 import com.google.dart.compiler.DartSource; | 11 import com.google.dart.compiler.DartSource; |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 switch (peek(0)) { | 698 switch (peek(0)) { |
| 699 case LT: | 699 case LT: |
| 700 nestingLevel++; | 700 nestingLevel++; |
| 701 break; | 701 break; |
| 702 case GT: | 702 case GT: |
| 703 nestingLevel--; | 703 nestingLevel--; |
| 704 break; | 704 break; |
| 705 case SAR: // >> | 705 case SAR: // >> |
| 706 nestingLevel -= 2; | 706 nestingLevel -= 2; |
| 707 break; | 707 break; |
| 708 case SHR: // >>> | |
| 709 nestingLevel -= 3; | |
| 710 break; | |
| 711 case COMMA: | 708 case COMMA: |
| 712 case IDENTIFIER: | 709 case IDENTIFIER: |
| 713 break; | 710 break; |
| 714 default: | 711 default: |
| 715 // We are looking at something other than type parameters. | 712 // We are looking at something other than type parameters. |
| 716 return false; | 713 return false; |
| 717 } | 714 } |
| 718 next(); | 715 next(); |
| 719 if (nestingLevel < 0) { | 716 if (nestingLevel < 0) { |
| 720 return false; | 717 return false; |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2264 return false; | 2261 return false; |
| 2265 case LT: | 2262 case LT: |
| 2266 count++; | 2263 count++; |
| 2267 break; | 2264 break; |
| 2268 case GT: | 2265 case GT: |
| 2269 count--; | 2266 count--; |
| 2270 break; | 2267 break; |
| 2271 case SHL: | 2268 case SHL: |
| 2272 count += 2; | 2269 count += 2; |
| 2273 break; | 2270 break; |
| 2274 case SHR: // >>> | |
| 2275 count -= 3; | |
| 2276 break; | |
| 2277 case SAR: // >> | 2271 case SAR: // >> |
| 2278 count -= 2; | 2272 count -= 2; |
| 2279 break; | 2273 break; |
| 2280 case COMMA: | 2274 case COMMA: |
| 2281 case IDENTIFIER: | 2275 case IDENTIFIER: |
| 2282 // extends is a pseudokeyword, so shows up as IDENTIFIER | 2276 // extends is a pseudokeyword, so shows up as IDENTIFIER |
| 2283 break; | 2277 break; |
| 2284 default: | 2278 default: |
| 2285 rollback(); | 2279 rollback(); |
| 2286 return false; | 2280 return false; |
| (...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3718 } | 3712 } |
| 3719 | 3713 |
| 3720 private boolean tryParameterizedTypeEnd() { | 3714 private boolean tryParameterizedTypeEnd() { |
| 3721 switch (peek(0)) { | 3715 switch (peek(0)) { |
| 3722 case GT: | 3716 case GT: |
| 3723 consume(Token.GT); | 3717 consume(Token.GT); |
| 3724 return true; | 3718 return true; |
| 3725 case SAR: | 3719 case SAR: |
| 3726 setPeek(0, Token.GT); | 3720 setPeek(0, Token.GT); |
| 3727 return true; | 3721 return true; |
| 3728 case SHR: | |
| 3729 setPeek(0, Token.SAR); | |
| 3730 return true; | |
| 3731 default: | 3722 default: |
| 3732 return false; | 3723 return false; |
| 3733 } | 3724 } |
| 3734 } | 3725 } |
| 3735 | 3726 |
| 3736 private DartTypeNode tryTypeAnnotation() { | 3727 private DartTypeNode tryTypeAnnotation() { |
| 3737 if (peek(0) != Token.IDENTIFIER) { | 3728 if (peek(0) != Token.IDENTIFIER) { |
| 3738 return null; | 3729 return null; |
| 3739 } | 3730 } |
| 3740 List<DartTypeNode> typeArguments = new ArrayList<DartTypeNode>(); | 3731 List<DartTypeNode> typeArguments = new ArrayList<DartTypeNode>(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3751 DartNode qualified2 = parseQualified(); | 3742 DartNode qualified2 = parseQualified(); |
| 3752 DartTypeNode argument; | 3743 DartTypeNode argument; |
| 3753 switch (peek(0)) { | 3744 switch (peek(0)) { |
| 3754 case LT: | 3745 case LT: |
| 3755 // qualified < qualified2 < | 3746 // qualified < qualified2 < |
| 3756 argument = done(new DartTypeNode(qualified2, parseTypeArguments())); | 3747 argument = done(new DartTypeNode(qualified2, parseTypeArguments())); |
| 3757 break; | 3748 break; |
| 3758 | 3749 |
| 3759 case GT: | 3750 case GT: |
| 3760 case SAR: | 3751 case SAR: |
| 3761 case SHR: | |
| 3762 // qualified < qualified2 > | 3752 // qualified < qualified2 > |
| 3763 case COMMA: | 3753 case COMMA: |
| 3764 // qualified < qualified2 , | 3754 // qualified < qualified2 , |
| 3765 argument = done(new DartTypeNode(qualified2, Collections.<DartTypeNode
>emptyList())); | 3755 argument = done(new DartTypeNode(qualified2, Collections.<DartTypeNode
>emptyList())); |
| 3766 break; | 3756 break; |
| 3767 | 3757 |
| 3768 default: | 3758 default: |
| 3769 done(null); | 3759 done(null); |
| 3770 rollback(); | 3760 rollback(); |
| 3771 return null; | 3761 return null; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3821 } | 3811 } |
| 3822 | 3812 |
| 3823 private void reportError(DartNode node, ErrorCode errorCode, Object... argumen
ts) { | 3813 private void reportError(DartNode node, ErrorCode errorCode, Object... argumen
ts) { |
| 3824 reportError(new DartCompilationError(node, errorCode, arguments)); | 3814 reportError(new DartCompilationError(node, errorCode, arguments)); |
| 3825 } | 3815 } |
| 3826 | 3816 |
| 3827 private boolean currentlyParsingToplevel() { | 3817 private boolean currentlyParsingToplevel() { |
| 3828 return !(isParsingInterface || isTopLevelAbstract || isParsingClass); | 3818 return !(isParsingInterface || isTopLevelAbstract || isParsingClass); |
| 3829 } | 3819 } |
| 3830 } | 3820 } |
| OLD | NEW |