[javascript] Parsing fails if there are curly braces inside a template literal
tanzaku opened this issue · comments
An error will occur when parsing a statement like the one below.
var nested = `Object in template literal ${JSON.stringify({ key: 'value' })}`
The error that occurs is as follows:
line 1:57 mismatched input '(' expecting TemplateCloseBrace
line 1:73 no viable alternative at input '}'
line 2:0 mismatched input '<EOF>' expecting {BackTick, '${', TemplateStringAtom}
I suspect that when there are curly braces within a template literal, the }
is mistaken for the end of the template literal, causing an error.