diff options
Diffstat (limited to 'runtime/queries')
-rw-r--r-- | runtime/queries/c-sharp/highlights.scm | 193 | ||||
-rw-r--r-- | runtime/queries/c/highlights.scm | 167 | ||||
-rw-r--r-- | runtime/queries/cairo/highlights.scm | 2 | ||||
-rw-r--r-- | runtime/queries/cpp/highlights.scm | 122 | ||||
-rw-r--r-- | runtime/queries/lua/folds.scm | 10 | ||||
-rw-r--r-- | runtime/queries/lua/highlights.scm | 77 | ||||
-rw-r--r-- | runtime/queries/lua/indents.scm | 10 | ||||
-rw-r--r-- | runtime/queries/lua/injections.scm | 3 | ||||
-rw-r--r-- | runtime/queries/lua/textobjects.scm | 15 | ||||
-rw-r--r-- | runtime/queries/markdown/injections.scm | 2 | ||||
-rw-r--r-- | runtime/queries/purescript/highlights.scm | 1 | ||||
-rw-r--r-- | runtime/queries/purescript/injections.scm | 1 | ||||
-rw-r--r-- | runtime/queries/purescript/locals.scm | 1 | ||||
-rw-r--r-- | runtime/queries/python/indents.scm (renamed from runtime/queries/python/indents.scm_) | 26 | ||||
-rw-r--r-- | runtime/queries/rust/highlights.scm | 3 | ||||
-rw-r--r-- | runtime/queries/twig/highlights.scm | 70 | ||||
-rw-r--r-- | runtime/queries/wgsl/highlights.scm | 175 | ||||
-rw-r--r-- | runtime/queries/zig/indents.scm | 8 |
18 files changed, 564 insertions, 322 deletions
diff --git a/runtime/queries/c-sharp/highlights.scm b/runtime/queries/c-sharp/highlights.scm index dbb7c778..38394862 100644 --- a/runtime/queries/c-sharp/highlights.scm +++ b/runtime/queries/c-sharp/highlights.scm @@ -10,24 +10,22 @@ name: (identifier) @function)) (invocation_expression - (member_access_expression - expression: (identifier) @variable)) - -(invocation_expression function: (conditional_access_expression (member_binding_expression name: (identifier) @function))) (invocation_expression - [(identifier) (qualified_name)] @function) + [(identifier) (qualified_name)] @function) + +(local_function_statement + name: (identifier) @function) ; Generic Method invocation with generic type (invocation_expression function: (generic_name - . (identifier) @function)) + . (identifier) @function)) ;; Namespaces - (namespace_declaration name: [(identifier) (qualified_name)] @namespace) @@ -40,8 +38,11 @@ (namespace_declaration name: (identifier) @type) (using_directive (_) @namespace) (constructor_declaration name: (identifier) @type) +(destructor_declaration name: (identifier) @type) (object_creation_expression [(identifier) (qualified_name)] @type) (type_parameter_list (type_parameter) @type) +(array_type (identifier) @type) +(for_each_statement type: (identifier) @type) [ (implicit_type) @@ -66,7 +67,7 @@ (object_creation_expression (generic_name - (identifier) @type)) + (identifier) @type)) (property_declaration (generic_name @@ -74,7 +75,7 @@ (_ type: (generic_name - (identifier) @type)) + (identifier) @type)) ;; Enum (enum_member_declaration (identifier) @variable.other.member) @@ -91,6 +92,7 @@ (verbatim_string_literal) (interpolated_string_text) (interpolated_verbatim_string_text) + (interpolation_format_clause) "\"" "$\"" "@$\"" @@ -107,6 +109,9 @@ (comment) @comment ;; Tokens +(type_argument_list ["<" ">"] @punctuation.bracket) +(type_parameter_list ["<" ">"] @punctuation.bracket) + [ ";" "." @@ -150,97 +155,112 @@ "%" "%=" ":" + "::" ".." "&=" "->" "??=" ] @operator -[ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket +["(" ")" "[" "]" "{" "}"] @punctuation.bracket ;; Keywords -(modifier) @keyword +(modifier) @keyword.storage.modifier (this_expression) @keyword (escape_sequence) @constant.character.escape [ "as" + "await" "base" - "break" - "case" - "catch" "checked" - "class" - "continue" - "default" - "delegate" - "do" - "else" - "enum" - "event" - "explicit" - "finally" - "for" - "foreach" - "goto" - "if" - "implicit" - "interface" + "from" + "get" + "in" + "init" "is" + "let" "lock" - "namespace" + "new" "operator" + "out" "params" - "return" + "ref" + "select" + "set" "sizeof" "stackalloc" - "static" - "struct" - "switch" - "throw" - "try" "typeof" "unchecked" "using" - "while" - "new" - "await" - "in" - "yield" - "get" - "set" "when" - "out" - "ref" - "from" "where" - "select" - "record" - "init" "with" - "let" + "yield" ] @keyword -(nullable_directive) @keyword.directive -(define_directive) @keyword.directive -(undef_directive) @keyword.directive -(if_directive) @keyword.directive -(else_directive) @keyword.directive -(elif_directive) @keyword.directive -(endif_directive) @keyword.directive -(region_directive) @keyword.directive -(endregion_directive) @keyword.directive -(error_directive) @keyword.directive -(warning_directive) @keyword.directive -(line_directive) @keyword.directive -(pragma_directive) @keyword.directive +[ + "class" + "delegate" + "enum" + "event" + "interface" + "namespace" + "struct" + "record" +] @keyword.storage.type + +[ + "explicit" + "implicit" + "static" +] @keyword.storage.modifier + +[ + "break" + "continue" + "goto" +] @keyword.control + +[ + "catch" + "finally" + "throw" + "try" +] @keyword.control.exception + +[ + "do" + "for" + "foreach" + "while" +] @keyword.control.repeat + +[ + "case" + "default" + "else" + "if" + "switch" +] @keyword.control.conditional + +"return" @keyword.control.return + +[ + (nullable_directive) + (define_directive) + (undef_directive) + (if_directive) + (else_directive) + (elif_directive) + (endif_directive) + (region_directive) + (endregion_directive) + (error_directive) + (warning_directive) + (line_directive) + (pragma_directive) +] @keyword.directive ;; Linq (from_clause (identifier) @variable) @@ -259,10 +279,16 @@ (binary_expression [(identifier) (qualified_name)] @variable [(identifier) (qualified_name)] @variable) (binary_expression [(identifier) (qualified_name)]* @variable) (conditional_expression [(identifier) (qualified_name)] @variable) +(conditional_access_expression [(identifier) (qualified_name)] @variable) (prefix_unary_expression [(identifier) (qualified_name)] @variable) (postfix_unary_expression [(identifier) (qualified_name)]* @variable) (assignment_expression [(identifier) (qualified_name)] @variable) (cast_expression [(identifier) (qualified_name)] @type [(identifier) (qualified_name)] @variable) +(element_access_expression (identifier) @variable) +(member_access_expression + expression: ([(identifier) (qualified_name)] @type + (#match? @type "^[A-Z]"))) +(member_access_expression [(identifier) (qualified_name)] @variable) ;; Class (base_list (identifier) @type) @@ -278,7 +304,6 @@ name: (identifier) @variable) ;; Delegate - (delegate_declaration (identifier) @type) ;; Lambda @@ -296,11 +321,11 @@ (parameter_list (parameter - name: (identifier) @parameter)) + name: (identifier) @parameter)) (parameter_list (parameter - type: [(identifier) (qualified_name)] @type)) + type: [(identifier) (qualified_name)] @type)) ;; Typeof (type_of_expression [(identifier) (qualified_name)] @type) @@ -315,7 +340,7 @@ ;; Type (generic_name (identifier) @type) -(type_parameter [(identifier) (qualified_name)] @variable.parameter) +(type_parameter [(identifier) (qualified_name)] @type) (type_argument_list [(identifier) (qualified_name)] @type) ;; Type constraints @@ -333,15 +358,21 @@ ;; Lock statement (lock_statement (identifier) @variable) +;; Declaration expression +(declaration_expression + type: (identifier) @type + name: (identifier) @variable) + ;; Rest -(member_access_expression) @variable -(element_access_expression (identifier) @variable) (argument (identifier) @variable) +(name_colon (identifier) @variable) +(if_statement (identifier) @variable) (for_statement (identifier) @variable) (for_each_statement (identifier) @variable) (expression_statement (identifier) @variable) -(member_access_expression expression: (identifier) @variable) -(member_access_expression name: (identifier) @variable) -(conditional_access_expression [(identifier) (qualified_name)] @variable) +(array_rank_specifier (identifier) @variable) +(equals_value_clause (identifier) @variable) +(interpolation (identifier) @variable) +(cast_expression (identifier) @variable) ((identifier) @comment.unused - (#eq? @comment.unused "_")) + (#eq? @comment.unused "_")) diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm index 647df05d..8122216d 100644 --- a/runtime/queries/c/highlights.scm +++ b/runtime/queries/c/highlights.scm @@ -1,71 +1,111 @@ -(storage_class_specifier) @keyword.storage - -"goto" @keyword -"register" @keyword -"break" @keyword -"case" @keyword -"continue" @keyword -"default" @keyword -"do" @keyword -"else" @keyword -"enum" @keyword -"extern" @keyword -"for" @keyword -"if" @keyword -"inline" @keyword -"return" @keyword "sizeof" @keyword -"struct" @keyword -"switch" @keyword -"typedef" @keyword -"union" @keyword -"volatile" @keyword -"while" @keyword -"const" @keyword [ - "#define" - "#elif" - "#else" - "#endif" - "#if" - "#ifdef" - "#ifndef" - "#include" - (preproc_directive) + "enum" + "struct" + "typedef" + "union" +] @keyword.storage.type + +[ + "extern" + "register" + (type_qualifier) + (storage_class_specifier) +] @keyword.storage.modifier + +[ + "goto" + "break" + "continue" +] @keyword.control + +[ + "do" + "for" + "while" +] @keyword.control.repeat + +[ + "if" + "else" + "switch" + "case" + "default" +] @keyword.control.conditional + +"return" @keyword.control.return + +[ + "defined" + "#define" + "#elif" + "#else" + "#endif" + "#if" + "#ifdef" + "#ifndef" + "#include" + (preproc_directive) ] @keyword.directive -"--" @operator -"-" @operator -"-=" @operator -"->" @operator -"=" @operator -"!=" @operator -"*" @operator -"&" @operator -"&&" @operator -"+" @operator -"++" @operator -"+=" @operator -"<" @operator -"==" @operator -">" @operator -"||" @operator -">=" @operator -"<=" @operator - -"." @punctuation.delimiter -";" @punctuation.delimiter +(pointer_declarator "*" @type.builtin) +(abstract_pointer_declarator "*" @type.builtin) + +[ + "+" + "-" + "*" + "/" + "++" + "--" + "%" + "==" + "!=" + ">" + "<" + ">=" + "<=" + "&&" + "||" + "!" + "&" + "|" + "^" + "~" + "<<" + ">>" + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + "<<=" + ">>=" + "&=" + "^=" + "|=" + "?" +] @operator + +(conditional_expression ":" @operator) + +"..." @punctuation + +["," "." ":" ";" "->" "::"] @punctuation.delimiter + +["(" ")" "[" "]" "{" "}"] @punctuation.bracket [(true) (false)] @constant.builtin.boolean -(enumerator) @type.enum.variant +(enumerator name: (identifier) @type.enum.variant) (string_literal) @string (system_lib_string) @string (null) @constant -(number_literal) @constant.numeric.integer +(number_literal) @constant.numeric (char_literal) @constant.character (call_expression @@ -73,19 +113,28 @@ (call_expression function: (field_expression field: (field_identifier) @function)) +(call_expression (argument_list (identifier) @variable)) (function_declarator - declarator: (identifier) @function) + declarator: [(identifier) (field_identifier)] @function) +(parameter_declaration + declarator: (identifier) @variable.parameter) +(parameter_declaration + (pointer_declarator + declarator: (identifier) @variable.parameter)) (preproc_function_def name: (identifier) @function.special) +(attribute + name: (identifier) @attribute) + (field_identifier) @variable.other.member (statement_identifier) @label (type_identifier) @type -(primitive_type) @type -(sized_type_specifier) @type +(primitive_type) @type.builtin +(sized_type_specifier) @type.builtin ((identifier) @constant - (#match? @constant "^[A-Z][A-Z\\d_]*$")) + (#match? @constant "^[A-Z][A-Z\\d_]*$")) (identifier) @variable diff --git a/runtime/queries/cairo/highlights.scm b/runtime/queries/cairo/highlights.scm index 3a30d188..c10ce5e0 100644 --- a/runtime/queries/cairo/highlights.scm +++ b/runtime/queries/cairo/highlights.scm @@ -36,7 +36,6 @@ [ "if" "else" - "end" "assert" "with" "with_attr" @@ -54,7 +53,6 @@ "const" "local" "struct" - "member" "alloc_locals" "tempvar" ] @keyword diff --git a/runtime/queries/cpp/highlights.scm b/runtime/queries/cpp/highlights.scm index 3348ef3c..8637489e 100644 --- a/runtime/queries/cpp/highlights.scm +++ b/runtime/queries/cpp/highlights.scm @@ -1,7 +1,11 @@ -; inherits: c - ; Functions +; These casts are parsed as function calls, but are not. +((identifier) @keyword (#eq? @keyword "static_cast")) +((identifier) @keyword (#eq? @keyword "dynamic_cast")) +((identifier) @keyword (#eq? @keyword "reinterpret_cast")) +((identifier) @keyword (#eq? @keyword "const_cast")) + (call_expression function: (qualified_identifier name: (identifier) @function)) @@ -12,56 +16,114 @@ (template_method name: (field_identifier) @function) -(template_function - name: (identifier) @function) - (function_declarator declarator: (qualified_identifier name: (identifier) @function)) (function_declarator declarator: (qualified_identifier - name: (identifier) @function)) + name: (qualified_identifier + name: (identifier) @function))) (function_declarator declarator: (field_identifier) @function) ; Types -((namespace_identifier) @type - (#match? @type "^[A-Z]")) +(using_declaration ("using" "namespace" (identifier) @namespace)) +(using_declaration ("using" "namespace" (qualified_identifier name: (identifier) @namespace))) +(namespace_definition name: (identifier) @namespace) +(namespace_identifier) @namespace + +(qualified_identifier name: (identifier) @type.enum.variant) (auto) @type +"decltype" @type + +(ref_qualifier ["&" "&&"] @type.builtin) +(reference_declarator ["&" "&&"] @type.builtin) +(abstract_reference_declarator ["&" "&&"] @type.builtin) ; Constants (this) @variable.builtin -(nullptr) @constant +(nullptr) @constant.builtin ; Keywords -"catch" @keyword -"class" @keyword -"constexpr" @keyword -"delete" @keyword -"explicit" @keyword -"final" @keyword -"friend" @keyword -"mutable" @keyword -"namespace" @keyword -"noexcept" @keyword -"new" @keyword -"override" @keyword -"private" @keyword -"protected" @keyword -"public" @keyword -"template" @keyword -"throw" @keyword -"try" @keyword -"typename" @keyword -"using" @keyword -"virtual" @keyword +(template_argument_list (["<" ">"] @punctuation.bracket)) +(template_parameter_list (["<" ">"] @punctuation.bracket)) +(default_method_clause "default" @keyword) + +"static_assert" @function.special + +[ + "<=>" + "[]" + "()" +] @operator + +[ + "co_await" + "co_return" + "co_yield" + "concept" + "delete" + "new" + "operator" + "requires" + "using" +] @keyword + +[ + "catch" + "noexcept" + "throw" + "try" +] @keyword.control.exception + + +[ + "and" + "and_eq" + "bitor" + "bitand" + "not" + "not_eq" + "or" + "or_eq" + "xor" + "xor_eq" +] @keyword.operator + +[ + "class" + "namespace" + "typename" + "template" +] @keyword.storage.type + +[ + "constexpr" + "constinit" + "consteval" + "mutable" +] @keyword.storage.modifier + +; Modifiers that aren't plausibly type/storage related. +[ + "explicit" + "friend" + "virtual" + (virtual_specifier) ; override/final + "private" + "protected" + "public" + "inline" ; C++ meaning differs from C! +] @keyword ; Strings (raw_string_literal) @string + +; inherits: c diff --git a/runtime/queries/lua/folds.scm b/runtime/queries/lua/folds.scm new file mode 100644 index 00000000..d8f0b42d --- /dev/null +++ b/runtime/queries/lua/folds.scm @@ -0,0 +1,10 @@ +[ + (do_statement) + (while_statement) + (repeat_statement) + (if_statement) + (for_statement) + (function_declaration) + (function_definition) + (table_constructor) +] @fold diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm index e73b32d6..f48e607c 100644 --- a/runtime/queries/lua/highlights.scm +++ b/runtime/queries/lua/highlights.scm @@ -1,7 +1,8 @@ ;;; Highlighting for lua ;;; Builtins -(self) @variable.builtin +((identifier) @variable.builtin + (#eq? @variable.builtin "self")) ;; Keywords @@ -12,20 +13,20 @@ "end" ] @keyword.control.conditional) +(elseif_statement [ - "else" "elseif" "then" -] @keyword.control.conditional + "end" +] @keyword.control.conditional) -(for_statement +(else_statement [ - "for" - "do" + "else" "end" -] @keyword.control.repeat) +] @keyword.control.conditional) -(for_in_statement +(for_statement [ "for" "do" @@ -51,21 +52,34 @@ "end" ] @keyword) +"return" @keyword.control.return + [ "in" "local" (break_statement) "goto" - "return" ] @keyword +(function_declaration +[ + "function" + "end" +] @keyword.function) + +(function_definition +[ + "function" + "end" +] @keyword.function) + ;; Operators [ "not" "and" "or" -] @operator +] @keyword.operator [ "=" @@ -95,6 +109,7 @@ ["," "." ":" ";"] @punctuation.delimiter ;; Brackets + [ "(" ")" @@ -110,7 +125,8 @@ (true) ] @constant.builtin.boolean (nil) @constant.builtin -(spread) @constant ;; "..." +(vararg_expression) @constant + ((identifier) @constant (#match? @constant "^[A-Z][A-Z_0-9]*$")) @@ -119,45 +135,32 @@ (identifier) @variable.parameter) ; ;; Functions -(function [(function_name) (identifier)] @function) -(function ["function" "end"] @keyword.function) - -(function - (function_name - (function_name_field - (property_identifier) @function .))) - -(local_function (identifier) @function) -(local_function ["function" "end"] @keyword.function) +(function_declaration name: (identifier) @function) +(function_call name: (identifier) @function.call) -(variable_declaration - (variable_declarator (identifier) @function) (function_definition)) -(local_variable_declaration - (variable_declarator (identifier) @function) (function_definition)) +(function_declaration name: (dot_index_expression field: (identifier) @function)) +(function_call name: (dot_index_expression field: (identifier) @function.call)) -(function_definition ["function" "end"] @keyword.function) +; TODO: incorrectly highlights variable N in `N, nop = 42, function() end` +(assignment_statement + (variable_list + name: (identifier) @function) + (expression_list + value: (function_definition))) -(function_call - [ - ((identifier) @variable (method) @function.method) - ((_) (method) @function.method) - (identifier) @function - (field_expression (property_identifier) @function) - ] - . (arguments)) +(method_index_expression method: (identifier) @function.method) ;; Nodes -(table ["{" "}"] @constructor) (comment) @comment (string) @string (number) @constant.numeric.integer (label_statement) @label ; A bit of a tricky one, this will only match field names (field . (identifier) @variable.other.member (_)) -(shebang) @comment +(hash_bang_line) @comment ;; Property -(property_identifier) @variable.other.member +(dot_index_expression field: (identifier) @variable.other.member) ;; Variable (identifier) @variable diff --git a/runtime/queries/lua/indents.scm b/runtime/queries/lua/indents.scm index 55a812c5..2e5a108e 100644 --- a/runtime/queries/lua/indents.scm +++ b/runtime/queries/lua/indents.scm @@ -1,17 +1,13 @@ [ (function_definition) - (variable_declaration) - (local_variable_declaration) + (function_declaration) + (method_index_expression) (field) - (local_function) - (function) (if_statement) (for_statement) - (for_in_statement) (repeat_statement) - (return_statement) (while_statement) - (table) + (table_constructor) (arguments) (do_statement) ] @indent diff --git a/runtime/queries/lua/injections.scm b/runtime/queries/lua/injections.scm index 321c90ad..fca94d58 100644 --- a/runtime/queries/lua/injections.scm +++ b/runtime/queries/lua/injections.scm @@ -1,2 +1,3 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment") + (#set! injection.include-children)) diff --git a/runtime/queries/lua/textobjects.scm b/runtime/queries/lua/textobjects.scm new file mode 100644 index 00000000..6fb2000d --- /dev/null +++ b/runtime/queries/lua/textobjects.scm @@ -0,0 +1,15 @@ +(function_definition + body: (_) @function.inside) @function.around + +(function_declaration + body: (_) @function.inside) @function.around + +(parameters + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(arguments + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(comment) @comment.inside + +(comment)+ @comment.around diff --git a/runtime/queries/markdown/injections.scm b/runtime/queries/markdown/injections.scm index f94b9f98..e184db15 100644 --- a/runtime/queries/markdown/injections.scm +++ b/runtime/queries/markdown/injections.scm @@ -7,6 +7,8 @@ ((html_block) @injection.content (#set! injection.language "html") (#set! injection.include-unnamed-children)) +((pipe_table_cell) @injection.content (#set! injection.language "markdown.inline") (#set! injection.include-unnamed-children)) + ((minus_metadata) @injection.content (#set! injection.language "yaml") (#set! injection.include-unnamed-children)) ((plus_metadata) @injection.content (#set! injection.language "toml") (#set! injection.include-unnamed-children)) diff --git a/runtime/queries/purescript/highlights.scm b/runtime/queries/purescript/highlights.scm new file mode 100644 index 00000000..ef073eb2 --- /dev/null +++ b/runtime/queries/purescript/highlights.scm @@ -0,0 +1 @@ +; inherits: haskell diff --git a/runtime/queries/purescript/injections.scm b/runtime/queries/purescript/injections.scm new file mode 100644 index 00000000..ef073eb2 --- /dev/null +++ b/runtime/queries/purescript/injections.scm @@ -0,0 +1 @@ +; inherits: haskell diff --git a/runtime/queries/purescript/locals.scm b/runtime/queries/purescript/locals.scm new file mode 100644 index 00000000..ef073eb2 --- /dev/null +++ b/runtime/queries/purescript/locals.scm @@ -0,0 +1 @@ +; inherits: haskell diff --git a/runtime/queries/python/indents.scm_ b/runtime/queries/python/indents.scm index 810ff52f..b7b499c0 100644 --- a/runtime/queries/python/indents.scm_ +++ b/runtime/queries/python/indents.scm @@ -28,11 +28,31 @@ ] @indent [ + (if_statement) + (for_statement) + (while_statement) + (with_statement) + (try_statement) + + (function_definition) + (class_definition) +] @extend + +[ + (return_statement) + (break_statement) + (continue_statement) + (raise_statement) + (pass_statement) +] @extend.prevent-once + +[ ")" "]" "}" - (return_statement) - (pass_statement) - (raise_statement) ] @outdent +(elif_clause + "elif" @outdent) +(else_clause + "else" @outdent) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 7d0afcde..81f05f7a 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -253,6 +253,9 @@ (function_item name: (identifier) @function) +(function_signature_item + name: (identifier) @function) + ; --- ; Macros ; --- diff --git a/runtime/queries/twig/highlights.scm b/runtime/queries/twig/highlights.scm index 2c95ab63..1ef8d06b 100644 --- a/runtime/queries/twig/highlights.scm +++ b/runtime/queries/twig/highlights.scm @@ -1,16 +1,60 @@ -(comment_directive) @comment +(comment) @comment + +(filter_identifier) @function.method +(function_identifier) @function.method +(test) @function.builtin +(variable) @variable +(string) @string +(interpolated_string) @string +(operator) @operator +(number) @constant.numeric.integer +(boolean) @constant.builtin.boolean +(null) @constant.builtin +(keyword) @keyword +(attribute) @attribute +(tag) @tag +(conditional) @keyword.control.conditional +(repeat) @keyword.control.repeat +(method) @function.method +(parameter) @variable.parameter [ - "{%" - "{%-" - "{%~" - "%}" - "-%}" - "~%}" - "{{" - "{{-" - "{{~" - "}}" - "-}}" - "~}}" + "{{" + "}}" + "{{-" + "-}}" + "{{~" + "~}}" + "{%" + "%}" + "{%-" + "-%}" + "{%~" + "~%}" ] @keyword + +[ + "," + "." + "?" + ":" + "=" +] @punctuation.delimiter + +(interpolated_string [ + "#{" + "}" +] @punctuation.delimiter) + +[ + "(" + ")" + "[" + "]" + "{" +] @punctuation.bracket + +(hash [ + "}" +] @punctuation.bracket) + diff --git a/runtime/queries/wgsl/highlights.scm b/runtime/queries/wgsl/highlights.scm index baf9dd8f..2817ea3a 100644 --- a/runtime/queries/wgsl/highlights.scm +++ b/runtime/queries/wgsl/highlights.scm @@ -2,57 +2,26 @@ (float_literal) @constant.numeric.float (bool_literal) @constant.builtin.boolean -(global_constant_declaration) @variable -(global_variable_declaration) @variable -(compound_statement) @variable -(const_expression) @function - -(variable_identifier_declaration - (identifier) @variable - (type_declaration) @type) - -(function_declaration - (identifier) @function - (function_return_type_declaration - (type_declaration) @type)) - -(parameter - (variable_identifier_declaration - (identifier) @variable.parameter - (type_declaration) @type)) - -(struct_declaration - (identifier) @type) - -(struct_declaration - (struct_member - (variable_identifier_declaration - (identifier) @variable.other.member - (type_declaration) @type))) +[ + "bitcast" + "discard" + "enable" + "fallthrough" +] @keyword -(type_constructor_or_function_call_expression - (type_declaration) @function) +[ + "let" + "override" + "struct" + "type" + "var" + (texel_format) +] @keyword.storage.type [ - "struct" - "bitcast" - "discard" - "enable" - "fallthrough" - "fn" - "let" - "private" - "read" - "read_write" - "storage" - "type" - "uniform" - "var" - "workgroup" - "write" - "override" - (texel_format) -] @keyword + (access_mode) + (address_space) +] @keyword.storage.modifier "fn" @keyword.function @@ -62,53 +31,87 @@ ["(" ")" "[" "]" "{" "}"] @punctuation.bracket +(type_declaration ["<" ">"] @punctuation.bracket) + [ - "loop" - "for" - "while" - "break" - "continue" - "continuing" + "break" + "continue" + "continuing" +] @keyword.control + +[ + "loop" + "for" + "while" ] @keyword.control.repeat [ - "if" - "else" - "switch" - "case" - "default" + "if" + "else" + "switch" + "case" + "default" ] @keyword.control.conditional [ - "&" - "&&" - "/" - "!" - "=" - "==" - "!=" - ">" - ">=" - ">>" - "<" - "<=" - "<<" - "%" - "-" - "+" - "|" - "||" - "*" - "~" - "^" - "@" - "++" - "--" + "!" + "!=" + "%" + "%=" + "&" + "&&" + "&=" + "*" + "*=" + "+" + "++" + "+=" + "-" + "--" + "-=" + "->" + "/" + "/=" + "<" + "<<" + "<=" + "=" + "==" + ">" + ">=" + ">>" + "@" + "^" + "^=" + "|" + "|=" + "||" + "~" ] @operator +(function_declaration + (identifier) @function) + +(parameter + (variable_identifier_declaration + (identifier) @variable.parameter)) + +(struct_declaration + (identifier) @type) + +(struct_declaration + (struct_member + (variable_identifier_declaration + (identifier) @variable.other.member))) + +(type_constructor_or_function_call_expression + (type_declaration (identifier) @function)) + +(type_declaration _ @type) + (attribute - (identifier) @attribute) + (identifier) @attribute) -(comment) @comment +(identifier) @variable -(ERROR) @error +(comment) @comment diff --git a/runtime/queries/zig/indents.scm b/runtime/queries/zig/indents.scm index af25a9c3..b177b165 100644 --- a/runtime/queries/zig/indents.scm +++ b/runtime/queries/zig/indents.scm @@ -1,12 +1,14 @@ [ + (AsmExpr) + (AssignExpr) (Block) (BlockExpr) (ContainerDecl) - (SwitchExpr) - (AssignExpr) (ErrorUnionExpr) - (Statement) (InitList) + (Statement) + (SwitchExpr) + (TestDecl) ] @indent [ |