Chromium Code Reviews| Index: frog/leg/scanner/parser.dart |
| diff --git a/frog/leg/scanner/parser.dart b/frog/leg/scanner/parser.dart |
| index b911d1d82de61e55a730522eafd15e6ae539613f..2d1bdffb84fc1d4f87232c816669a0bfb9945f05 100644 |
| --- a/frog/leg/scanner/parser.dart |
| +++ b/frog/leg/scanner/parser.dart |
| @@ -942,10 +942,21 @@ class Parser { |
| Token parseUnaryExpression(Token token) { |
| String value = token.stringValue; |
| // Prefix: |
| - if ((value === '!') || |
| - (value === '+') || // TODO(ahe): Being removed from specification. |
| - (value === '-') || |
| - (value === '~')) { |
| + if (value === '+') { |
| + // Dart only allows "prefix plus" as an initial part of a |
| + // decimal literal. We scan it as a separate token and then throws |
|
ahe
2012/02/03 11:28:51
throws -> throw
|
| + // it away here when we know that we have an unary plus, not a |
|
ahe
2012/02/03 11:28:51
"an unary" -> "a unary"
http://owl.english.purdue
|
| + // binary one. |
|
Lasse Reichstein Nielsen
2012/02/03 13:30:17
Comment updated.
|
| + Token next = token.next; |
| + if (next.charOffset === token.charOffset + 1) { |
| + if (next.kind === INT_TOKEN) return parseLiteralInt(next); |
|
ahe
2012/02/03 11:28:51
We shouldn't throw tokens away. Long term, it beco
Lasse Reichstein Nielsen
2012/02/03 13:10:22
I think we should throw it away in the listener in
ahe
2012/02/03 13:19:11
Unfortunately, that way of thinking is counter-pro
Lasse Reichstein Nielsen
2012/02/03 13:30:17
I'm not advocating throwing the character away, bu
ahe
2012/02/03 13:41:10
We could do that. I guess it would be limited to L
|
| + if (next.kind === DOUBLE_TOKEN) return parseLiteralDouble(next); |
| + } |
| + listener.recoverableError("Unexpected token '+'", token: token); |
| + return parseUnaryExpression(next); |
| + } else if ((value === '!') || |
| + (value === '-') || |
| + (value === '~')) { |
| Token operator = token; |
| // Right associative, so we recurse at the same precedence |
| // level. |