From b13999952fbf811ffee0b24c0111c7317c90af78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Wed, 22 May 2024 01:06:08 +0900 Subject: [PATCH] queries: update more grammars --- runtime/queries/awk/highlights.scm | 9 +++++---- runtime/queries/bash/highlights.scm | 3 +++ runtime/queries/c/highlights.scm | 23 ++++++++++++----------- runtime/queries/clojure/highlights.scm | 16 ++++++++-------- runtime/queries/cpp/highlights.scm | 4 ++-- runtime/queries/java/highlights.scm | 4 ++-- runtime/queries/move/highlights.scm | 7 ++++--- runtime/queries/openscad/highlights.scm | 5 +++-- 8 files changed, 39 insertions(+), 32 deletions(-) diff --git a/runtime/queries/awk/highlights.scm b/runtime/queries/awk/highlights.scm index 34d660ad5..7254b1305 100644 --- a/runtime/queries/awk/highlights.scm +++ b/runtime/queries/awk/highlights.scm @@ -109,14 +109,15 @@ (number) @constant.numeric (string) @string -(func_call name: (identifier) @function) -(func_def name: (identifier) @function) - -(field_ref (_) @variable) [ (identifier) (field_ref) ] @variable +(func_call name: (identifier) @function) +(func_def name: (identifier) @function) + +(field_ref (_) @variable) + (ns_qualified_name "::" @operator) (ns_qualified_name (namespace) @namespace) diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm index 67d5f7cb9..731106448 100644 --- a/runtime/queries/bash/highlights.scm +++ b/runtime/queries/bash/highlights.scm @@ -46,6 +46,9 @@ (comment) @comment +((word) @constant.builtin.boolean + (#any-of? @constant.builtin.boolean "true" "false")) + (function_definition name: (word) @function) (file_descriptor) @constant.numeric.integer diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm index 07915f4e3..e48e45ab5 100644 --- a/runtime/queries/c/highlights.scm +++ b/runtime/queries/c/highlights.scm @@ -1,3 +1,9 @@ + +(identifier) @variable + +((identifier) @constant + (#match? @constant "^[A-Z][A-Z\\d_]*$")) + "sizeof" @keyword [ @@ -109,6 +115,12 @@ (char_literal) @constant.character (escape_sequence) @constant.character.escape +(field_identifier) @variable.other.member +(statement_identifier) @label +(type_identifier) @type +(primitive_type) @type.builtin +(sized_type_specifier) @type.builtin + (call_expression function: (identifier) @function) (call_expression @@ -128,15 +140,4 @@ (attribute name: (identifier) @attribute) -(field_identifier) @variable.other.member -(statement_identifier) @label -(type_identifier) @type -(primitive_type) @type.builtin -(sized_type_specifier) @type.builtin - -((identifier) @constant - (#match? @constant "^[A-Z][A-Z\\d_]*$")) - -(identifier) @variable - (comment) @comment diff --git a/runtime/queries/clojure/highlights.scm b/runtime/queries/clojure/highlights.scm index 1441ea97d..8155e6e3b 100644 --- a/runtime/queries/clojure/highlights.scm +++ b/runtime/queries/clojure/highlights.scm @@ -10,6 +10,14 @@ (comment) @comment +;; other symbols +(sym_lit) @variable + +;; other calls +(list_lit + . + (sym_lit) @function) + ;; metadata experiment (meta_lit marker: "^" @punctuation) @@ -61,20 +69,12 @@ ((sym_lit) @operator (#match? @operator "^%")) -;; other calls -(list_lit - . - (sym_lit) @function) - ;; interop-ish (list_lit . (sym_lit) @function.method (#match? @function.method "^\\.")) -;; other symbols -(sym_lit) @variable - ;; quote (quoting_lit) @constant.character.escape diff --git a/runtime/queries/cpp/highlights.scm b/runtime/queries/cpp/highlights.scm index c1d14a0b1..b168b3306 100644 --- a/runtime/queries/cpp/highlights.scm +++ b/runtime/queries/cpp/highlights.scm @@ -1,3 +1,5 @@ +; inherits: c + ; Functions ; These casts are parsed as function calls, but are not. @@ -132,5 +134,3 @@ ; Strings (raw_string_literal) @string - -; inherits: c diff --git a/runtime/queries/java/highlights.scm b/runtime/queries/java/highlights.scm index ae99a33ab..1f5da9c60 100644 --- a/runtime/queries/java/highlights.scm +++ b/runtime/queries/java/highlights.scm @@ -1,3 +1,5 @@ +(identifier) @variable + ; Methods (method_declaration @@ -54,8 +56,6 @@ ((identifier) @constant (#match? @constant "^_*[A-Z][A-Z\\d_]+$")) -(identifier) @variable - (this) @variable.builtin ; Literals diff --git a/runtime/queries/move/highlights.scm b/runtime/queries/move/highlights.scm index 86a79dc22..bf607e1f2 100644 --- a/runtime/queries/move/highlights.scm +++ b/runtime/queries/move/highlights.scm @@ -23,12 +23,16 @@ (borrow_expression "&" @keyword.storage.modifier.ref) (borrow_expression "&mut" @keyword.storage.modifier.mut) +(identifier) @variable + (constant_identifier) @constant ((identifier) @constant (#match? @constant "^[A-Z][A-Z\\d_]*$")) (function_identifier) @function +(primitive_type) @type.builtin + (struct_identifier) @type (pack_expression access: (module_access @@ -152,6 +156,3 @@ "with" ] @keyword -(primitive_type) @type.buildin - -(identifier) @variable diff --git a/runtime/queries/openscad/highlights.scm b/runtime/queries/openscad/highlights.scm index c06738e85..90d5ac59d 100644 --- a/runtime/queries/openscad/highlights.scm +++ b/runtime/queries/openscad/highlights.scm @@ -3,13 +3,14 @@ (boolean) @constant.builtin.boolean (include_path) @string.special.path +(identifier) @variable + (parameters_declaration (identifier) @variable.parameter) (function_declaration name: (identifier) @function) (function_call function: (identifier) @function) (module_call name: (identifier) @function) -(identifier) @variable (special_variable) @variable.builtin [ @@ -60,4 +61,4 @@ "." ] @punctuation.delimiter -(comment) @comment \ No newline at end of file +(comment) @comment