Skip to content

Commit 94cdad6

Browse files
committed
Make language injections easier
1 parent 971acdd commit 94cdad6

File tree

14 files changed

+4051
-4183
lines changed

14 files changed

+4051
-4183
lines changed

grammar.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ module.exports = grammar({
44
extras: ($) => [/\s+/, $.line_continuation, $.comment],
55
externals: ($) => [
66
$.heredoc_marker,
7-
$.heredoc_line,
7+
$._heredoc_line,
88
$.heredoc_end,
9-
$.heredoc_nl,
9+
$._heredoc_nl,
1010
$.error_sentinel,
1111
],
1212

@@ -210,8 +210,8 @@ module.exports = grammar({
210210
// \n if there's at least one open heredoc to avoid conflicts.
211211
// We also alias this token to hide it from the output like all other
212212
// whitespace.
213-
alias($.heredoc_nl, "_heredoc_nl"),
214-
repeat(seq($.heredoc_line, "\n")),
213+
$._heredoc_nl,
214+
repeat(seq($._heredoc_line, "\n")),
215215
$.heredoc_end
216216
),
217217

@@ -373,16 +373,16 @@ module.exports = grammar({
373373

374374
shell_command: ($) =>
375375
seq(
376-
$.shell_fragment,
376+
$._shell_fragment,
377377
repeat(
378378
seq(
379379
alias($.required_line_continuation, $.line_continuation),
380-
$.shell_fragment
380+
$._shell_fragment
381381
)
382382
)
383383
),
384384

385-
shell_fragment: ($) => repeat1(
385+
_shell_fragment: ($) => repeat1(
386386
choice(
387387
// A shell fragment is broken into the same tokens as other
388388
// constructs because the lexer prefers the longer tokens
@@ -486,6 +486,6 @@ module.exports = grammar({
486486

487487
_non_newline_whitespace: () => token.immediate(/[\t ]+/),
488488

489-
comment: () => /#.*/,
489+
comment: () => /#.*\n/,
490490
},
491491
});

queries/highlights.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
(double_quoted_string)
4242
(single_quoted_string)
4343
(json_string)
44-
(heredoc_line)
44+
(heredoc_block)
4545
] @string
4646

4747
(expansion

src/grammar.json

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

src/node-types.json

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

0 commit comments

Comments
 (0)