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 library dart2js.parser; | 5 library dart2js.parser; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../tokens/keyword.dart' show Keyword; | 8 import '../tokens/keyword.dart' show Keyword; |
9 import '../tokens/precedence.dart' show PrecedenceInfo; | 9 import '../tokens/precedence.dart' show PrecedenceInfo; |
10 import '../tokens/precedence_constants.dart' | 10 import '../tokens/precedence_constants.dart' |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 token = tryParseQualified(token); | 570 token = tryParseQualified(token); |
571 if (token == null) return null; | 571 if (token == null) return null; |
572 Token tokenAfterQualified = token; | 572 Token tokenAfterQualified = token; |
573 token = tryParseNestedTypeArguments(token); | 573 token = tryParseNestedTypeArguments(token); |
574 return token == null ? tokenAfterQualified : token; | 574 return token == null ? tokenAfterQualified : token; |
575 } | 575 } |
576 | 576 |
577 /// Returns token after match if [token] matches identifier ('.' identifier)?, | 577 /// Returns token after match if [token] matches identifier ('.' identifier)?, |
578 /// and otherwise returns null. Does not produce listener events. | 578 /// and otherwise returns null. Does not produce listener events. |
579 Token tryParseQualified(Token token) { | 579 Token tryParseQualified(Token token) { |
580 if (!identical(token.kind, IDENTIFIER_TOKEN)) return null; | 580 if (!isValidTypeReference(token)) return null; |
581 token = token.next; | 581 token = token.next; |
582 if (!identical(token.kind, PERIOD_TOKEN)) return token; | 582 if (!identical(token.kind, PERIOD_TOKEN)) return token; |
583 token = token.next; | 583 token = token.next; |
584 if (!identical(token.kind, IDENTIFIER_TOKEN)) return null; | 584 if (!identical(token.kind, IDENTIFIER_TOKEN)) return null; |
585 return token.next; | 585 return token.next; |
586 } | 586 } |
587 | 587 |
588 /// Returns token after match if [token] matches '<' type (',' type)* '>', | 588 /// Returns token after match if [token] matches '<' type (',' type)* '>', |
589 /// and otherwise returns null. Does not produce listener events. The final | 589 /// and otherwise returns null. Does not produce listener events. The final |
590 /// '>' may be the first character in a '>>' token, in which case a synthetic | 590 /// '>' may be the first character in a '>>' token, in which case a synthetic |
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2991 } | 2991 } |
2992 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2992 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
2993 return expectSemicolon(token); | 2993 return expectSemicolon(token); |
2994 } | 2994 } |
2995 | 2995 |
2996 Token parseEmptyStatement(Token token) { | 2996 Token parseEmptyStatement(Token token) { |
2997 listener.handleEmptyStatement(token); | 2997 listener.handleEmptyStatement(token); |
2998 return expectSemicolon(token); | 2998 return expectSemicolon(token); |
2999 } | 2999 } |
3000 } | 3000 } |
OLD | NEW |