Skip to content

Commit c3fedaf

Browse files
committed
feat(grammar): support window rules in exec
1 parent d626ec0 commit c3fedaf

File tree

8 files changed

+3108
-2252
lines changed

8 files changed

+3108
-2252
lines changed

grammar.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,27 @@ module.exports = grammar({
5454

5555
source: ($) => seq("source", "=", $.string, $._linebreak),
5656

57-
exec: ($) =>
57+
arguments: ($) => repeat1(choice($.number, alias($._window_rule_argument, $.string))),
58+
59+
window_rule: ($) => seq($.name, optional($.arguments)),
60+
61+
rules: ($) => seq("[", $.window_rule, repeat(seq(';', $.window_rule)), "]"),
62+
63+
exec: ($) => choice(
64+
seq(
65+
choice("exec-once", "exec"),
66+
"=",
67+
optional($.rules),
68+
$.string,
69+
$._linebreak,
70+
),
5871
seq(
59-
choice("exec-once", "execr-once", "exec", "execr", "exec-shutdown"),
72+
choice("execr-once", "execr", "exec-shutdown"),
6073
"=",
6174
$.string,
6275
$._linebreak,
6376
),
77+
),
6478

6579
_value: ($) =>
6680
choice(
@@ -138,8 +152,11 @@ module.exports = grammar({
138152

139153
_zero: () => "0",
140154

155+
_window_rule_argument: () => /[^\]\s;,]+/,
156+
141157
_linebreak: () => "\n",
142158

143159
comment: () => seq("#", /.*/),
160+
144161
},
145162
});

queries/hyprlang/highlights.scm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
(section
1919
(name) @module)
2020

21+
(window_rule
22+
(name) @function.call)
23+
2124
(section
2225
device: (device_name) @type)
2326

@@ -45,13 +48,18 @@
4548

4649
"deg" @type
4750

48-
"," @punctuation.delimiter
51+
[
52+
","
53+
";"
54+
] @punctuation.delimiter
4955

5056
[
5157
"("
5258
")"
5359
"{"
5460
"}"
61+
"["
62+
"]"
5563
] @punctuation.bracket
5664

5765
[

src/grammar.json

Lines changed: 138 additions & 20 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: 71 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)