diff --git a/grammar.js b/grammar.js index 17f6be2..f3fc6b4 100644 --- a/grammar.js +++ b/grammar.js @@ -1457,11 +1457,13 @@ module.exports = grammar({ template_string: $ => seq( token(seq( - optional(choice( - 'j', - 'js', - 'json', - )), + optional( + choice( + /[a-z_][a-zA-Z0-9_']*/, + // escape_sequence + seq('\\"', /[^"]+/ , '"'), + ) + ), '`', )), $.template_string_content, diff --git a/test/corpus/literals.txt b/test/corpus/literals.txt index 1bbf616..14f4e2c 100644 --- a/test/corpus/literals.txt +++ b/test/corpus/literals.txt @@ -130,6 +130,8 @@ The caller should either handle this error, or expect that exit code.` `\\` +anything`Hello` + ---- (source_file @@ -156,7 +158,8 @@ The caller should either handle this error, or expect that exit code.` (escape_sequence) (template_substitution (value_identifier))))) (expression_statement (template_string (template_string_content))) - (expression_statement (template_string (template_string_content (escape_sequence))))) + (expression_statement (template_string (template_string_content (escape_sequence)))) + (expression_statement (template_string (template_string_content)))) ============================================ Tricky template strings