| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // TODO(jimhug): Error recovery needs major work! | 5 // TODO(jimhug): Error recovery needs major work! |
| 6 /** | 6 /** |
| 7 * A simple recursive descent parser for the dart language. | 7 * A simple recursive descent parser for the dart language. |
| 8 * | 8 * |
| 9 * This parser is designed to be more permissive than the official | 9 * This parser is designed to be more permissive than the official |
| 10 * Dart grammar. It is expected that many grammar errors would be | 10 * Dart grammar. It is expected that many grammar errors would be |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 int start = _peekToken.start; | 434 int start = _peekToken.start; |
| 435 var factoryToken = _next(); | 435 var factoryToken = _next(); |
| 436 | 436 |
| 437 var names = [identifier()]; | 437 var names = [identifier()]; |
| 438 while (_maybeEat(TokenKind.DOT)) { | 438 while (_maybeEat(TokenKind.DOT)) { |
| 439 names.add(identifier()); | 439 names.add(identifier()); |
| 440 } | 440 } |
| 441 if (_peekKind(TokenKind.LT)) { | 441 if (_peekKind(TokenKind.LT)) { |
| 442 var tp = typeParameters(); | 442 var tp = typeParameters(); |
| 443 world.warning('type parameters on factories are no longer supported, ' | 443 world.warning('type parameters on factories are no longer supported, ' |
| 444 + 'place them on the class instead', _makeSpan(tp[0].span.start)); | 444 'place them on the class instead', _makeSpan(tp[0].span.start)); |
| 445 } | 445 } |
| 446 | 446 |
| 447 var name = null; | 447 var name = null; |
| 448 var type = null; | 448 var type = null; |
| 449 if (_maybeEat(TokenKind.DOT)) { | 449 if (_maybeEat(TokenKind.DOT)) { |
| 450 name = identifier(); | 450 name = identifier(); |
| 451 } else { | 451 } else { |
| 452 if (names.length > 1) { | 452 if (names.length > 1) { |
| 453 name = names.removeLast(); | 453 name = names.removeLast(); |
| 454 } else { | 454 } else { |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 int _pos = 0; | 1739 int _pos = 0; |
| 1740 next() { | 1740 next() { |
| 1741 var token = tokens[_pos]; | 1741 var token = tokens[_pos]; |
| 1742 ++_pos; | 1742 ++_pos; |
| 1743 if (_pos == tokens.length) { | 1743 if (_pos == tokens.length) { |
| 1744 parser.tokenizer = previousTokenizer; | 1744 parser.tokenizer = previousTokenizer; |
| 1745 } | 1745 } |
| 1746 return token; | 1746 return token; |
| 1747 } | 1747 } |
| 1748 } | 1748 } |
| OLD | NEW |