Skip to content

Commit ad7a716

Browse files
ribru17clason
authored andcommitted
fix: use token.immediate() on end string quote
**Problem:** The end quote on a string was not marked as an immediate token, so trailing whitespace after `string_content` would not be captured by `string_content`, and would just be part of the `string` node, with no child. **Solution:** Mark the end delimiter as an immediate token, meaning all trailing whitespace gets captured as `string_content`.
1 parent 892ebd7 commit ad7a716

File tree

3 files changed

+173
-139
lines changed

3 files changed

+173
-139
lines changed

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module.exports = grammar({
7272
string: $ => seq(
7373
'"',
7474
optional($.string_content),
75-
'"',
75+
token.immediate('"'),
7676
),
7777
string_content: $ => repeat1(choice(token.immediate(prec(PREC.STRING, /[^"\\\n]+/)), $.escape_sequence)),
7878
parameters: $ => repeat1(choice($.capture, $.string, $._node_identifier)),

src/grammar.json

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)