Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: strings can't start with "?" #15

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = grammar({
$.basic_directive,
$.theme_directive,
$.palette_directive,
$.config_file_directive,
$.path_directive,
$.keybind_directive,
),

Expand Down Expand Up @@ -67,7 +67,7 @@ module.exports = grammar({
seq('"', /[^"\r\n]*/, '"'),
seq("'", /[^'\r\n]*/, "'"),
seq(
/[^#\s]/,
/[^#\s\?]/,
$._raw_value,
)
)),
Expand Down Expand Up @@ -113,8 +113,9 @@ module.exports = grammar({
$.color
),

// `config-file` directive
config_file_directive: $ => directive_seq(alias("config-file", $.property), $.path_value),
// directives that take files as input, it's impossible to distinguish syntactically so we must list them out manually
path_property: $ => choice("config-file", "gtk-custom-css", "custom-shader"),
path_directive: $ => directive_seq(alias($.path_property, $.property), $.path_value),
path_value: $ => seq(
optional("?"),
$.string
Expand Down
6 changes: 3 additions & 3 deletions queries/ghostty/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
(palette_value "=" @operator
(#eq? @operator "="))

; `config-file`
(config_file_directive (property) @keyword.import)
(config_file_directive (path_value) @string.special.path)
; `path directives`
(path_directive (property) @keyword.import)
(path_directive (path_value) @string.special.path)
(path_value "?" @keyword.conditional
(#eq? @keyword.conditional "?"))

Expand Down
27 changes: 22 additions & 5 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 41 additions & 29 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading