Skip to content

Commit e51a18b

Browse files
committed
feat: more details are added to bracket arguments and comments
The bracket arguments and comments now have open, content, close explicitly marked instead of just their overall token.
1 parent fe48221 commit e51a18b

File tree

8 files changed

+9179
-8000
lines changed

8 files changed

+9179
-8000
lines changed

grammar.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ const commands = [
1818
module.exports = grammar({
1919
name: "cmake",
2020

21-
externals: ($) => [$.bracket_argument, $.bracket_comment, $.line_comment],
21+
externals: ($) => [
22+
$.bracket_argument_open,
23+
$.bracket_argument_content,
24+
$.bracket_argument_close,
25+
26+
$.bracket_comment_open,
27+
$.bracket_comment_content,
28+
$.bracket_comment_close,
29+
30+
$.line_comment,
31+
],
2232
extras: (_) => [],
2333

2434
rules: {
@@ -35,6 +45,9 @@ module.exports = grammar({
3545
env_var: ($) => seq("$", "ENV", "{", $.variable, "}"),
3646
cache_var: ($) => seq("$", "CACHE", "{", $.variable, "}"),
3747

48+
bracket_argument: ($) => seq($.bracket_argument_open, $.bracket_argument_content, $.bracket_argument_close),
49+
bracket_comment: ($) => seq($.bracket_comment_open, $.bracket_comment_content, $.bracket_comment_close),
50+
3851
argument: ($) => choice($.bracket_argument, $.quoted_argument, $.unquoted_argument),
3952
_untrimmed_argument: ($) => choice(/\s/, $.bracket_comment, $.line_comment, $.argument, $._paren_argument),
4053
_paren_argument: ($) => seq("(", repeat($._untrimmed_argument), ")"),

src/grammar.json

Lines changed: 52 additions & 2 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: 64 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)