| 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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 } | 966 } |
| 967 } | 967 } |
| 968 } | 968 } |
| 969 | 969 |
| 970 finishCallOrLambdaExpression(expr) { | 970 finishCallOrLambdaExpression(expr) { |
| 971 if (_atClosureParameters()) { | 971 if (_atClosureParameters()) { |
| 972 var formals = formalParameterList(); | 972 var formals = formalParameterList(); |
| 973 var body = functionBody(true); | 973 var body = functionBody(true); |
| 974 return _makeFunction(expr, formals, body); | 974 return _makeFunction(expr, formals, body); |
| 975 } else { | 975 } else { |
| 976 if (expr is DeclaredIdentifier) { |
| 977 _error('illegal target for call, did you mean to declare a function?', |
| 978 expr.span); |
| 979 } |
| 976 var args = arguments(); | 980 var args = arguments(); |
| 977 return finishPostfixExpression( | 981 return finishPostfixExpression( |
| 978 new CallExpression(expr, args, _makeSpan(expr.span.start))); | 982 new CallExpression(expr, args, _makeSpan(expr.span.start))); |
| 979 } | 983 } |
| 980 } | 984 } |
| 981 | 985 |
| 982 /** Checks if the given expression is a binary op of the given kind. */ | 986 /** Checks if the given expression is a binary op of the given kind. */ |
| 983 _isBin(expr, kind) { | 987 _isBin(expr, kind) { |
| 984 return expr is BinaryExpression && expr.op.kind == kind; | 988 return expr is BinaryExpression && expr.op.kind == kind; |
| 985 } | 989 } |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 int _pos = 0; | 1684 int _pos = 0; |
| 1681 next() { | 1685 next() { |
| 1682 var token = tokens[_pos]; | 1686 var token = tokens[_pos]; |
| 1683 ++_pos; | 1687 ++_pos; |
| 1684 if (_pos == tokens.length) { | 1688 if (_pos == tokens.length) { |
| 1685 parser.tokenizer = previousTokenizer; | 1689 parser.tokenizer = previousTokenizer; |
| 1686 } | 1690 } |
| 1687 return token; | 1691 return token; |
| 1688 } | 1692 } |
| 1689 } | 1693 } |
| OLD | NEW |