Skip to content

Commit ce1ef35

Browse files
authored
Merge pull request #208 from aspeddro/fix-char
fix: template string empty char
2 parents 1ba755b + ecb5aaa commit ce1ef35

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

grammar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ module.exports = grammar({
14611461
),
14621462
'`',
14631463
)),
1464-
$.template_string_content,
1464+
optional($.template_string_content),
14651465
'`'
14661466
),
14671467

@@ -1470,6 +1470,7 @@ module.exports = grammar({
14701470
choice(
14711471
$._template_chars,
14721472
$.template_substitution,
1473+
/\s/,
14731474
choice(
14741475
alias('\\`', $.escape_sequence),
14751476
$.escape_sequence,

test/corpus/literals.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ Quote escaping
111111
Template strings
112112
============================================
113113

114+
``
115+
` `
116+
` \b`
114117
`one line`
115118
`multi
116119
line`
@@ -132,9 +135,13 @@ The caller should either handle this error, or expect that exit code.`
132135

133136
anything`Hello`
134137

138+
135139
----
136140

137141
(source_file
142+
(expression_statement (template_string))
143+
(expression_statement (template_string (template_string_content)))
144+
(expression_statement (template_string (template_string_content (escape_sequence))))
138145
(expression_statement (template_string (template_string_content)))
139146
(expression_statement (template_string (template_string_content)))
140147
(expression_statement (template_string (template_string_content)))

0 commit comments

Comments
 (0)