diff --git a/src/compiler/tests/literals.test.ts b/src/compiler/tests/literals.test.ts index e2321f7..3a2905f 100644 --- a/src/compiler/tests/literals.test.ts +++ b/src/compiler/tests/literals.test.ts @@ -231,4 +231,10 @@ describe('curly strings', () => { expect(`{ This is $({twisted}). }`).toEvaluateTo(` This is twisted. `) expect(`{ This is $({{twisted}}). }`).toEvaluateTo(` This is {twisted}. `) }) -}) \ No newline at end of file + + test('interpolation edge cases', () => { + expect(`{[a=1 b=2 c={wild}]}`).toEvaluateTo(`[a=1 b=2 c={wild}]`) + expect(`a = 1;b = 2;c = 3;{$a $b $c}`).toEvaluateTo(`1 2 3`) + expect(`a = 1;b = 2;c = 3;{$a$b$c}`).toEvaluateTo(`123`) + }) +}) diff --git a/src/parser/curlyTokenizer.ts b/src/parser/curlyTokenizer.ts index 6a6de66..bc8acf0 100644 --- a/src/parser/curlyTokenizer.ts +++ b/src/parser/curlyTokenizer.ts @@ -49,7 +49,7 @@ export const tokenizeCurlyString = (value: string): (string | [string, Tree])[] const input = value.slice(start + 1, pos) // skip '$' tokens.push([input, parser.parse(input)]) - start = pos + start = pos-- // backtrack and start over } }