| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.generated.parser; | 5 library analyzer.src.generated.parser; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 3431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3442 | 3442 |
| 3443 /** | 3443 /** |
| 3444 * Parse a statement. Return the statement that was parsed. | 3444 * Parse a statement. Return the statement that was parsed. |
| 3445 * | 3445 * |
| 3446 * statement ::= | 3446 * statement ::= |
| 3447 * label* nonLabeledStatement | 3447 * label* nonLabeledStatement |
| 3448 */ | 3448 */ |
| 3449 Statement parseStatement2() { | 3449 Statement parseStatement2() { |
| 3450 List<Label> labels = new List<Label>(); | 3450 List<Label> labels = new List<Label>(); |
| 3451 while (_matchesIdentifier() && _tokenMatches(_peek(), TokenType.COLON)) { | 3451 while (_matchesIdentifier() && _tokenMatches(_peek(), TokenType.COLON)) { |
| 3452 labels.add(parseLabel()); | 3452 labels.add(parseLabel(isDeclaration: true)); |
| 3453 } | 3453 } |
| 3454 Statement statement = _parseNonLabeledStatement(); | 3454 Statement statement = _parseNonLabeledStatement(); |
| 3455 if (labels.isEmpty) { | 3455 if (labels.isEmpty) { |
| 3456 return statement; | 3456 return statement; |
| 3457 } | 3457 } |
| 3458 return new LabeledStatement(labels, statement); | 3458 return new LabeledStatement(labels, statement); |
| 3459 } | 3459 } |
| 3460 | 3460 |
| 3461 /** | 3461 /** |
| 3462 * Parse a sequence of statements, starting with the given [token]. Return the | 3462 * Parse a sequence of statements, starting with the given [token]. Return the |
| (...skipping 4273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7736 Expression expression = parseExpression2(); | 7736 Expression expression = parseExpression2(); |
| 7737 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); | 7737 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); |
| 7738 Token leftBracket = _expect(TokenType.OPEN_CURLY_BRACKET); | 7738 Token leftBracket = _expect(TokenType.OPEN_CURLY_BRACKET); |
| 7739 Token defaultKeyword = null; | 7739 Token defaultKeyword = null; |
| 7740 List<SwitchMember> members = new List<SwitchMember>(); | 7740 List<SwitchMember> members = new List<SwitchMember>(); |
| 7741 while (!_matches(TokenType.EOF) && | 7741 while (!_matches(TokenType.EOF) && |
| 7742 !_matches(TokenType.CLOSE_CURLY_BRACKET)) { | 7742 !_matches(TokenType.CLOSE_CURLY_BRACKET)) { |
| 7743 List<Label> labels = new List<Label>(); | 7743 List<Label> labels = new List<Label>(); |
| 7744 while ( | 7744 while ( |
| 7745 _matchesIdentifier() && _tokenMatches(_peek(), TokenType.COLON)) { | 7745 _matchesIdentifier() && _tokenMatches(_peek(), TokenType.COLON)) { |
| 7746 SimpleIdentifier identifier = parseSimpleIdentifier(); | 7746 SimpleIdentifier identifier = |
| 7747 parseSimpleIdentifier(isDeclaration: true); |
| 7747 String label = identifier.token.lexeme; | 7748 String label = identifier.token.lexeme; |
| 7748 if (definedLabels.contains(label)) { | 7749 if (definedLabels.contains(label)) { |
| 7749 _reportErrorForToken( | 7750 _reportErrorForToken( |
| 7750 ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, | 7751 ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, |
| 7751 identifier.token, | 7752 identifier.token, |
| 7752 [label]); | 7753 [label]); |
| 7753 } else { | 7754 } else { |
| 7754 definedLabels.add(label); | 7755 definedLabels.add(label); |
| 7755 } | 7756 } |
| 7756 Token colon = _expect(TokenType.COLON); | 7757 Token colon = _expect(TokenType.COLON); |
| (...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9956 */ | 9957 */ |
| 9957 const ParserErrorCode(String name, String message, [String correction]) | 9958 const ParserErrorCode(String name, String message, [String correction]) |
| 9958 : super(name, message, correction); | 9959 : super(name, message, correction); |
| 9959 | 9960 |
| 9960 @override | 9961 @override |
| 9961 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 9962 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 9962 | 9963 |
| 9963 @override | 9964 @override |
| 9964 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | 9965 ErrorType get type => ErrorType.SYNTACTIC_ERROR; |
| 9965 } | 9966 } |
| OLD | NEW |