Chromium Code Reviews| Index: lib/compiler/implementation/scanner/parser.dart |
| diff --git a/lib/compiler/implementation/scanner/parser.dart b/lib/compiler/implementation/scanner/parser.dart |
| index f43bddc1f2c4955d7476e928f87da1d11bc1d80e..d2bc38fa749845bbe4da4e56ad55d3dbe24f3c2f 100644 |
| --- a/lib/compiler/implementation/scanner/parser.dart |
| +++ b/lib/compiler/implementation/scanner/parser.dart |
| @@ -278,6 +278,9 @@ class Parser { |
| return token; |
| } |
| + /** |
| + * Returns true if the stringValue of the [token] is [value]. |
| + */ |
| bool optional(String value, Token token) => value === token.stringValue; |
| bool notEofOrValue(String value, Token token) { |
| @@ -1283,12 +1286,22 @@ class Parser { |
| listener.beginLiteralString(token); |
| token = token.next; |
| int interpolationCount = 0; |
| - while (optional('\${', token)) { |
| - token = token.next; |
| - token = parseExpression(token); |
| - token = expect('}', token); |
| - token = parseStringPart(token); |
| - ++interpolationCount; |
| + while (token.kind != EOF_TOKEN) { |
| + if (optional('\${', token)) { |
| + token = token.next; |
| + token = parseExpression(token); |
| + token = expect('}', token); |
| + token = parseStringPart(token); |
| + ++interpolationCount; |
| + } else if (optional('\$', token)) { |
|
ahe
2012/06/22 08:42:49
I don't like testing for '$' as it can also be an
Johnni Winther
2012/06/22 10:23:10
Changed to use the new STRING_INTERPOLATION_IDENTI
|
| + token = token.next; |
| + token = parseExpression(token); |
| + token = expect('', token); |
|
ahe
2012/06/22 08:42:49
I think we can avoid creating a group in this case
Johnni Winther
2012/06/22 10:23:10
Done.
|
| + token = parseStringPart(token); |
| + ++interpolationCount; |
| + } else { |
| + break; |
| + } |
| } |
| listener.endLiteralString(interpolationCount); |
| return token; |