From 1836328c24db345965b4f9d1e20db4262b8ddd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sun, 31 May 2026 21:30:37 +0900 Subject: [PATCH] lang: Migrate abandoned grammars to tree-sitter-grammars --- languages.toml | 6 +- runtime/queries/meson/highlights.scm | 73 ++++++++++-------------- runtime/queries/meson/indents.scm | 16 ++---- runtime/queries/ungrammar/highlights.scm | 22 ++++--- 4 files changed, 52 insertions(+), 65 deletions(-) diff --git a/languages.toml b/languages.toml index 5fbe1754..920746d3 100644 --- a/languages.toml +++ b/languages.toml @@ -417,7 +417,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "toml" -source = { git = "https://github.com/ikatyang/tree-sitter-toml", rev = "7cff70bbcbbc62001b465603ca1ea88edd668704" } +source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-toml", rev = "64b56832c2cffe41758f28e05c756a3a98d16f41" } [[language]] name = "awk" @@ -2778,7 +2778,7 @@ language-servers = ["mesonlsp"] [[grammar]] name = "meson" -source = { git = "https://github.com/staysail/tree-sitter-meson", rev = "32a83e8f200c347232fa795636cfe60dde22957a" } +source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-meson", rev = "c84f3540624b81fc44067030afce2ff78d6ede05" } [[language]] name = "sshclientconfig" @@ -2977,7 +2977,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "ungrammar" -source = { git = "https://github.com/Philipp-M/tree-sitter-ungrammar", rev = "a7e104629cff5a8b7367187610631e8f5eb7c6ea" } +source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-ungrammar", rev = "debd26fed283d80456ebafa33a06957b0c52e451" } [[language]] name = "dot" diff --git a/runtime/queries/meson/highlights.scm b/runtime/queries/meson/highlights.scm index 58c2baca..0277ee7b 100644 --- a/runtime/queries/meson/highlights.scm +++ b/runtime/queries/meson/highlights.scm @@ -1,62 +1,49 @@ (comment) @comment -(identifier) @variable +(number) @constant.numeric.integer +(bool) @constant.builtin.boolean +(string) @string +(escape_sequence) @constant.character.escape [ - (assignment_operator) - (additive_operator) - (multiplicative_operator) - (equality_operator) - ">=" - "<=" - "<" - ">" - "+" - "-" -] @operator + "(" ")" "[" "]" "{" "}" +] @punctuation.bracket [ - (and) - (or) - (not) - (in) -] @keyword.operator + "," "." ":" +] @punctuation.delimiter [ - "(" ")" "[" "]" "{" "}" -] @punctuation.bracket + "=" "==" "!=" "+" "+=" "-=" "/" "/=" "<" ">" ">=" "?" +] @operator [ - (if) - (elif) - (else) - (endif) + "and" "or" "not" "in" +] @keyword.operator + +[ + "if" "elif" "else" "endif" ] @keyword.control.conditional [ - (foreach) - (endforeach) - (break) - (continue) + "foreach" "endforeach" + (keyword_break) + (keyword_continue) ] @keyword.control.repeat -(boolean_literal) @constant.builtin.boolean -(int_literal) @constant.numeric.integer +; Format-string placeholder `@var@`. +"@" @punctuation.special -(keyword_argument keyword: (identifier) @variable.parameter) -(escape_sequence) @constant.character.escape -(bad_escape) @warning +(identifier) @variable -[ -"." -"," -":" -] @punctuation.delimiter +; Command calls: `project(...)`, `executable(...)`. +(normal_command + command: (identifier) @function) -[ - (string_literal) - (fstring_literal) -] @string +; Method calls: `obj.method(...)` — the property is the method name. +(expression_statement + property: (identifier) @function.method) -; these are listed last, because they override keyword queries -(function_expression (identifier) @function) +; Dictionary / keyword-argument keys. +(pair + key: (identifier) @variable.other.member) diff --git a/runtime/queries/meson/indents.scm b/runtime/queries/meson/indents.scm index 2a4c6c62..b54de291 100644 --- a/runtime/queries/meson/indents.scm +++ b/runtime/queries/meson/indents.scm @@ -1,17 +1,13 @@ -; Indentation queries for helix [ - (function_expression) - (array_literal) - (dictionary_literal) - (selection_statement) - (iteration_statement) + (if_condition) + (foreach_command) + (list) + (dictionaries) ] @indent -; question - what about else, elif [ - ")" "]" "}" - (endif) - (endforeach) + "endif" + "endforeach" ] @outdent diff --git a/runtime/queries/ungrammar/highlights.scm b/runtime/queries/ungrammar/highlights.scm index 07d17fcb..ca5b9a05 100644 --- a/runtime/queries/ungrammar/highlights.scm +++ b/runtime/queries/ungrammar/highlights.scm @@ -1,21 +1,25 @@ -(line_comment) @comment +(comment) @comment -(identifier) @function +; The node name on the left of `=` being defined. +(definition) @type -(labeled_rule - (identifier) @type) +; References to other rules. +(identifier) @variable -(node_rule - (identifier) @variable.parameter) +(label_name) @label (token) @string [ "=" "|" - ":" - "(" - ")" "?" "*" ] @operator + +":" @punctuation.delimiter + +[ + "(" + ")" +] @punctuation.bracket -- 2.51.2