"Double quoted strings" #35

Merged
defunkt merged 6 commits from double-quote-strings into main 2025-11-09 00:14:23 +00:00
2 changed files with 8 additions and 2 deletions
Showing only changes of commit 238af9affc - Show all commits

View File

@ -231,4 +231,10 @@ describe('curly strings', () => {
expect(`{ This is $({twisted}). }`).toEvaluateTo(` This is twisted. `)
expect(`{ This is $({{twisted}}). }`).toEvaluateTo(` This is {twisted}. `)
})
})
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`)
})
})

View File

@ -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
}
}