diff options
| author | Amaan Qureshi <amaanq12@gmail.com> | 2023-04-21 04:06:20 -0400 |
|---|---|---|
| committer | Amaan Qureshi <amaanq12@gmail.com> | 2023-04-21 18:24:17 -0400 |
| commit | 85330918f05b3a4bd342a69063e7ef5fcdfadd2e (patch) | |
| tree | 6b38f8e3af9ad1079ba94ffc7056263b056d0c00 | |
| parent | fix(c): types are optional in sized_type_specifier (diff) | |
| download | nvim-treesitter-85330918f05b3a4bd342a69063e7ef5fcdfadd2e.tar nvim-treesitter-85330918f05b3a4bd342a69063e7ef5fcdfadd2e.tar.gz nvim-treesitter-85330918f05b3a4bd342a69063e7ef5fcdfadd2e.tar.bz2 nvim-treesitter-85330918f05b3a4bd342a69063e7ef5fcdfadd2e.tar.lz nvim-treesitter-85330918f05b3a4bd342a69063e7ef5fcdfadd2e.tar.xz nvim-treesitter-85330918f05b3a4bd342a69063e7ef5fcdfadd2e.tar.zst nvim-treesitter-85330918f05b3a4bd342a69063e7ef5fcdfadd2e.zip | |
perf: remove match where possible
37 files changed, 104 insertions, 113 deletions
diff --git a/queries/bash/highlights.scm b/queries/bash/highlights.scm index d1cdb659d..6fd1d39d5 100644 --- a/queries/bash/highlights.scm +++ b/queries/bash/highlights.scm @@ -84,7 +84,7 @@ (#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$")) ((word) @boolean - (#match? @boolean "^(true|false)$")) + (#any-of? @boolean "true" "false")) (comment) @comment @spell (test_operator) @string @@ -133,4 +133,4 @@ (regex) @string.regex ((program . (comment) @preproc) - (#match? @preproc "^#!/")) + (#lua-match? @preproc "^#!/")) diff --git a/queries/bicep/highlights.scm b/queries/bicep/highlights.scm index 07c2c4efa..b555edb37 100644 --- a/queries/bicep/highlights.scm +++ b/queries/bicep/highlights.scm @@ -18,7 +18,7 @@ ((member_expression object: (identifier) @type.builtin) - (#match? @type.builtin "^sys$")) + (#eq? @type.builtin "sys")) ; Functions diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index a070b7ffd..69b9abd9d 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -59,28 +59,28 @@ ; Inline function variables ((sym_lit) @variable.builtin - (#match? @variable.builtin "^[%]")) + (#lua-match? @variable.builtin "^%%")) ; Constructor ((sym_lit) @constructor - (#match? @constructor "^-\\>[^\\>].*")) + (#lua-match? @constructor "^-\\>[^\\>].*")) ; Dynamic variables ((sym_lit) @variable.builtin - (#match? @variable.builtin "^[*].+[*]$")) + (#lua-match? @variable.builtin "^[*].+[*]$")) ; Gensym ;; Might not be needed ((sym_lit) @variable - (#match? @variable "^.*#$")) + (#lua-match? @variable "^.*#$")) ; Types ;; TODO: improve? ((sym_lit) @type - (#match? @type "^[A-Z][^/]*$")) + (#lua-match? @type "^[%u][^/]*$")) ;; Symbols with `.` but not `/` ((sym_lit) @type - (#match? @type "^[^/]+[.][^/]*$")) + (#lua-match? @type "^[^/]+[.][^/]*$")) ; Interop ((sym_lit) @method @@ -88,11 +88,11 @@ ((sym_lit) @field (#match? @field "^\\.-")) ((sym_lit) @field - (#match? @field "^[A-Z].*/.+")) + (#lua-match? @field "^[%u].*/.+")) (list_lit . (sym_lit) @method - (#match? @method "^[A-Z].*/.+")) + (#lua-match? @method "^[%u].*/.+")) ;; TODO: Special casing for the `.` macro ; Operators diff --git a/queries/cmake/highlights.scm b/queries/cmake/highlights.scm index 80bf80752..b6cc26d2c 100644 --- a/queries/cmake/highlights.scm +++ b/queries/cmake/highlights.scm @@ -159,7 +159,7 @@ . (argument) @_transform @constant . (argument) @variable . (argument) @_action @constant - (#match? @_transform "TRANSFORM") + (#eq? @_transform "TRANSFORM") (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE") ) (normal_command @@ -169,7 +169,7 @@ . (argument) @variable . (argument) @_action @constant . (argument)? @_selector @constant - (#match? @_transform "TRANSFORM") + (#eq? @_transform "TRANSFORM") (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE") (#any-of? @_selector "AT" "FOR" "REGEX") ) @@ -179,8 +179,8 @@ . (argument) @_transform @constant (argument) @constant . (argument) @variable - (#match? @_transform "TRANSFORM") - (#match? @constant "OUTPUT_VARIABLE") + (#eq? @_transform "TRANSFORM") + (#eq? @constant "OUTPUT_VARIABLE") ) (escape_sequence) @string.escape diff --git a/queries/commonlisp/highlights.scm b/queries/commonlisp/highlights.scm index 536b19c81..d898afe79 100644 --- a/queries/commonlisp/highlights.scm +++ b/queries/commonlisp/highlights.scm @@ -64,7 +64,7 @@ (num_lit) @number -((sym_lit) @boolean (#match? @boolean "^(t|T)$")) +((sym_lit) @boolean (#any-of? @boolean "t" "T")) (nil_lit) @constant.builtin @@ -72,7 +72,7 @@ ;; dynamic variables ((sym_lit) @variable.builtin - (#match? @variable.builtin "^[*].+[*]$")) + (#lua-match? @variable.builtin "^[*].+[*]$")) ;; quote "'" @string.escape @@ -147,7 +147,7 @@ ;; constant ((sym_lit) @constant - (#match? @constant "^[+].+[+]$")) + (#lua-match? @constant "^[+].+[+]$")) (var_quoting_lit marker: "#'" @symbol @@ -180,7 +180,7 @@ ((sym_lit) @symbol -(#match? @symbol "^[&]")) +(#lua-match? @symbol "^[&]")) [(array_dimension) "#0A" "#0a"] @number diff --git a/queries/commonlisp/locals.scm b/queries/commonlisp/locals.scm index acdf965b7..471fad408 100644 --- a/queries/commonlisp/locals.scm +++ b/queries/commonlisp/locals.scm @@ -22,14 +22,14 @@ (sym_lit) @_deftest . (sym_lit) @definition.function - (#match? @_deftest "^(deftest)$")) @scope + (#eq? @_deftest "deftest")) @scope (list_lit . (sym_lit) @_deftest . (sym_lit) @definition.function - (#match? @_deftest "^(deftest)$")) @scope + (#eq? @_deftest "deftest")) @scope (for_clause . (sym_lit) @definition.var) (with_clause . (sym_lit) @definition.var) diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 97a3b9f39..9516645f6 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,7 +1,7 @@ ; inherits: c ((identifier) @field - (#match? @field "(^_|^m_|_$)")) + (#lua-match? @field "^m?_.*$")) (parameter_declaration declarator: (reference_declarator) @parameter) @@ -39,7 +39,7 @@ (namespace_identifier) @namespace ((namespace_identifier) @type - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[%u]")) (case_statement value: (qualified_identifier (identifier) @constant)) @@ -135,26 +135,26 @@ ((function_declarator (qualified_identifier (identifier) @constructor)) - (#lua-match? @constructor "^[A-Z]")) + (#lua-match? @constructor "^%u")) ((call_expression function: (identifier) @constructor) -(#lua-match? @constructor "^[A-Z]")) +(#lua-match? @constructor "^%u")) ((call_expression function: (qualified_identifier name: (identifier) @constructor)) -(#lua-match? @constructor "^[A-Z]")) +(#lua-match? @constructor "^%u")) ((call_expression function: (field_expression field: (field_identifier) @constructor)) -(#lua-match? @constructor "^[A-Z]")) +(#lua-match? @constructor "^%u")) ;; constructing a type in an initializer list: Constructor (): **SuperType (1)** ((field_initializer (field_identifier) @constructor (argument_list)) - (#lua-match? @constructor "^[A-Z]")) + (#lua-match? @constructor "^%u")) ; Constants diff --git a/queries/css/highlights.scm b/queries/css/highlights.scm index bacc5bd26..b26f0ec96 100644 --- a/queries/css/highlights.scm +++ b/queries/css/highlights.scm @@ -57,9 +57,9 @@ (namespace_name) @namespace ((property_name) @type.definition - (#match? @type.definition "^--")) + (#lua-match? @type.definition "^[-][-]")) ((plain_value) @type - (#match? @type "^--")) + (#lua-match? @type "^[-][-]")) [ (string_value) diff --git a/queries/cue/highlights.scm b/queries/cue/highlights.scm index 50137c7b3..8e626d63c 100644 --- a/queries/cue/highlights.scm +++ b/queries/cue/highlights.scm @@ -97,7 +97,7 @@ (primitive_type) @type.builtin ((identifier) @type - (#match? @type "^(#|_#)")) + (#lua-match? @type "^_?#")) [ (slice_type) diff --git a/queries/dart/highlights.scm b/queries/dart/highlights.scm index e34467f65..372a6389c 100644 --- a/queries/dart/highlights.scm +++ b/queries/dart/highlights.scm @@ -11,7 +11,7 @@ ; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't ; specifically identify a node as a function call -(((identifier) @function (#match? @function "^_?[a-z]")) +(((identifier) @function (#lua-match? @function "^_?[%l]")) . (selector . (argument_part))) @function ; Annotations @@ -100,7 +100,7 @@ ((scoped_identifier scope: (identifier) @type name: (identifier) @type) - (#match? @type "^[a-zA-Z]")) + (#lua-match? @type "^[%u%l]")) (type_identifier) @type @@ -113,7 +113,7 @@ (inferred_type) @keyword ((identifier) @type - (#match? @type "^_?[A-Z].*[a-z]")) ; catch Classes or IClasses not CLASSES + (#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES ("Function" @type) diff --git a/queries/dhall/highlights.scm b/queries/dhall/highlights.scm index 4bf79d090..f0c454cf1 100644 --- a/queries/dhall/highlights.scm +++ b/queries/dhall/highlights.scm @@ -20,7 +20,7 @@ ([ (let_binding (label) @type) (union_type_entry (label) @type) -] (#match? @type "^[A-Z]")) +] (#lua-match? @type "^%u")) ((primitive_expression (identifier (label) @type) diff --git a/queries/dockerfile/highlights.scm b/queries/dockerfile/highlights.scm index 2d1840e66..592e70423 100644 --- a/queries/dockerfile/highlights.scm +++ b/queries/dockerfile/highlights.scm @@ -55,9 +55,3 @@ (expose_instruction (expose_port) @number) - -((stopsignal_instruction) @number - (#match? @number "[0-9][0-9]?$")) - -((stopsignal_instruction) @constant.builtin - (#match? @constant.builtin "SIG(ABRT|HUP|INT|KILL|QUIT|STOP|TERM|TSTP)$")) diff --git a/queries/ebnf/highlights.scm b/queries/ebnf/highlights.scm index 416aaab68..feafa1cef 100644 --- a/queries/ebnf/highlights.scm +++ b/queries/ebnf/highlights.scm @@ -11,13 +11,13 @@ ; Allow different highlighting for specific casings ((identifier) @type - (#match? @type "^[A-Z]")) + (#lua-match? @type "^%u")) ((identifier) @symbol - (#match? @symbol "^[a-z]")) + (#lua-match? @symbol "^%l")) ((identifier) @constant - (#match? @constant "^[A-Z][A-Z0-9_]+$")) + (#lua-match? @constant "^%u[%u%d_]+$")) ;;; Punctuation ;;;; [ diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index 712c780ac..ba0ea4fa1 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -90,7 +90,7 @@ (assignment_expression left: (member_expression property: (property_identifier) @_prop - (#match? @_prop "(out|inn)erHTML")) + (#any-of? @_prop "innerHTML" "outerHTML")) right: (template_string) @html (#offset! @html 0 1 0 -1)) @@ -98,6 +98,6 @@ (assignment_expression left: (member_expression property: (property_identifier) @_prop - (#match? @_prop "(out|inn)erHTML")) + (#any-of? @_prop "innerHTML" "outerHTML")) right: (string) @html (#offset! @html 0 1 0 -1)) diff --git a/queries/elixir/highlights.scm b/queries/elixir/highlights.scm index 3223fa683..81bf5f858 100644 --- a/queries/elixir/highlights.scm +++ b/queries/elixir/highlights.scm @@ -26,7 +26,7 @@ (identifier) @variable ; Unused Identifiers -((identifier) @comment (#match? @comment "^_")) +((identifier) @comment (#lua-match? @comment "^_")) ; Comments (comment) @comment @spell diff --git a/queries/fennel/highlights.scm b/queries/fennel/highlights.scm index fcb7e8b5e..43aca53ad 100644 --- a/queries/fennel/highlights.scm +++ b/queries/fennel/highlights.scm @@ -40,7 +40,7 @@ (list . (multi_symbol (symbol) @function .)) ((symbol) @variable.builtin - (#match? @variable.builtin "^[$]")) + (#lua-match? @variable.builtin "^[$]")) (binding) @symbol diff --git a/queries/fish/highlights.scm b/queries/fish/highlights.scm index 91978e148..d12cbd781 100644 --- a/queries/fish/highlights.scm +++ b/queries/fish/highlights.scm @@ -15,12 +15,12 @@ ;; match operators of test command (command - name: (word) @function.builtin (#match? @function.builtin "^test$") + name: (word) @function.builtin (#eq? @function.builtin "test") argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) ;; match operators of [ command (command - name: (word) @punctuation.bracket (#match? @punctuation.bracket "^\\[$") + name: (word) @punctuation.bracket (#eq? @punctuation.bracket "[") argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) [ @@ -106,7 +106,7 @@ (command argument: [ - (word) @parameter (#match? @parameter "^-") + (word) @parameter (#lua-match? @parameter "^[-]") ] ) @@ -137,7 +137,7 @@ option: [ (word) (concatenation (word)) - ] @parameter (#match? @parameter "^-") + ] @parameter (#lua-match? @parameter "^[-]") ) ;; Strings @@ -160,7 +160,7 @@ (#any-of? @boolean "true" "false")) ((program . (comment) @preproc) - (#match? @preproc "^#!/")) + (#lua-match? @preproc "^#!/")) ;; Error diff --git a/queries/foam/highlights.scm b/queries/foam/highlights.scm index 86a3bf324..11d31e692 100644 --- a/queries/foam/highlights.scm +++ b/queries/foam/highlights.scm @@ -23,16 +23,11 @@ directive: (identifier)* @conditional argument: (identifier)* @namespace ) -( - (preproc_call - argument: (identifier)* @namespace - ) @conditional - (#match? @conditional "ifeq") -) -( - (preproc_call) @conditional - (#match? @conditional "(else|endif)") -) +((preproc_call + argument: (identifier)* @namespace) @conditional + (#eq? @conditional "ifeq")) +((preproc_call) @conditional + (#any-of? @conditional "else" "endif")) ;; Literal numbers and strings (number_literal) @float @@ -64,6 +59,7 @@ ] @punctuation.delimiter ;; Special identifiers -([(identifier) "on" "off" "true" "false" "yes" "no"] @constant.builtin -(#match? @constant.builtin "^(uniform|non-uniform|and|or|on|off|true|false|yes|no)$") -) +[ "on" "off" "true" "false" "yes" "no" ] @constant.builtin + +((identifier) @constant.builtin + (#any-of? @constant.builtin "uniform" "non-uniform" "and" "or")) diff --git a/queries/fusion/highlights.scm b/queries/fusion/highlights.scm index b093f8872..bb24a413f 100644 --- a/queries/fusion/highlights.scm +++ b/queries/fusion/highlights.scm @@ -18,7 +18,7 @@ (eel_object_path (eel_path_identifier) @variable.builtin - (#match? @variable.builtin "^(this|props)$") + (#any-of? @variable.builtin "this" "props") ) (eel_object_path diff --git a/queries/glimmer/highlights.scm b/queries/glimmer/highlights.scm index b1b3f9141..70a48cf83 100644 --- a/queries/glimmer/highlights.scm +++ b/queries/glimmer/highlights.scm @@ -3,10 +3,10 @@ ; Tags that start with a lower case letter are HTML tags ; We'll also use this highlighting for named blocks (which start with `:`) ((tag_name) @tag - (#match? @tag "^(:)?[a-z]")) + (#lua-match? @tag "^:?[%l]")) ; Tags that start with a capital letter are Glimmer components ((tag_name) @constructor - (#lua-match? @constructor "^[A-Z]")) + (#lua-match? @constructor "^%u")) (attribute_name) @property @@ -38,7 +38,7 @@ (path_expression (identifier) @variable) (identifier) @variable ]) - (#not-match? @variable "yield|outlet|this|else")) + (#not-any-of? @variable "yield" "outlet" "this" "else")) ; As are arguments in a block statement (block_statement_start argument: [ (path_expression (identifier) @variable) @@ -51,10 +51,10 @@ (path_expression (identifier) @variable) (identifier) @variable ]) - (#not-match? @variable "this")) + (#not-eq? @variable "this")) ; `this` should be highlighted as a built-in variable ((identifier) @variable.builtin - (#lua-match? @variable.builtin "this")) + (#eq? @variable.builtin "this")) ; If the identifier is just "yield" or "outlet", it's a keyword ((mustache_statement (identifier) @keyword) @@ -65,11 +65,11 @@ (path_expression (identifier) @function) (identifier) @function ]) - (#not-match? @function "if|yield")) + (#not-any-of? @function "if" "yield")) ((helper_invocation helper: (identifier) @conditional) - (#lua-match? @conditional "if")) + (#eq? @conditional "if")) ((helper_invocation helper: (identifier) @keyword) - (#lua-match? @keyword "yield")) + (#eq? @keyword "yield")) (hash_pair key: (identifier) @property) diff --git a/queries/html_tags/highlights.scm b/queries/html_tags/highlights.scm index b6a90f726..f44a853b0 100644 --- a/queries/html_tags/highlights.scm +++ b/queries/html_tags/highlights.scm @@ -10,19 +10,19 @@ (#match? @_tag "^(h[0-9]|title)$")) ((element (start_tag (tag_name) @_tag) (text) @text.strong) - (#match? @_tag "^(strong|b)$")) + (#any-of? @_tag "strong" "b")) ((element (start_tag (tag_name) @_tag) (text) @text.emphasis) - (#match? @_tag "^(em|i)$")) + (#any-of? @_tag "em" "i")) ((element (start_tag (tag_name) @_tag) (text) @text.strike) - (#match? @_tag "^(s|del)$")) + (#any-of? @_tag "s" "del")) ((element (start_tag (tag_name) @_tag) (text) @text.underline) (#eq? @_tag "u")) ((element (start_tag (tag_name) @_tag) (text) @text.literal) - (#match? @_tag "^(code|kbd)$")) + (#any-of? @_tag "code" "kbd")) ((element (start_tag (tag_name) @_tag) (text) @text.uri) (#eq? @_tag "a")) @@ -30,7 +30,7 @@ ((attribute (attribute_name) @_attr (quoted_attribute_value (attribute_value) @text.uri)) - (#match? @_attr "^(href|src)$")) + (#any-of? @_attr "href" "src")) [ "<" diff --git a/queries/julia/injections.scm b/queries/julia/injections.scm index ff79619c0..259395da5 100644 --- a/queries/julia/injections.scm +++ b/queries/julia/injections.scm @@ -8,7 +8,7 @@ (assignment) (const_declaration) ] - (#match? @markdown "^\"\"\"") + (#lua-match? @markdown "^\"\"\"") (#offset! @markdown 0 3 0 -3)) [ diff --git a/queries/ocaml/highlights.scm b/queries/ocaml/highlights.scm index bb8a30539..ef045f1b1 100644 --- a/queries/ocaml/highlights.scm +++ b/queries/ocaml/highlights.scm @@ -58,10 +58,8 @@ (application_expression function: (value_path (value_name) @function)) -( - (value_name) @function.builtin - (#match? @function.builtin "^(raise(_notrace)?|failwith|invalid_arg)$") -) +((value_name) @function.builtin + (#any-of? @function.builtin "raise" "raise_notrace" "failwith" "invalid_arg")) ; Properties ;----------- diff --git a/queries/perl/highlights.scm b/queries/perl/highlights.scm index c6b2c4ee4..45ad8db72 100644 --- a/queries/perl/highlights.scm +++ b/queries/perl/highlights.scm @@ -90,7 +90,7 @@ (comments) @spell ((source_file . (comments) @preproc) - (#match? @preproc "^#!/")) + (#lua-match? @preproc "^#!/")) ; POD should be handled specially with its own embedded subtype but for now ; we'll just have to do this. diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index 86cb46b5a..30747b1fa 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -29,7 +29,7 @@ ((attribute attribute: (identifier) @field) - (#match? @field "^([A-Z])@!.*$")) + (#lua-match? @field "^%u@!.*$")) ((identifier) @type.builtin (#any-of? @type.builtin @@ -71,12 +71,12 @@ ((call function: (identifier) @constructor) - (#lua-match? @constructor "^[A-Z]")) + (#lua-match? @constructor "^%u")) ((call function: (attribute attribute: (identifier) @constructor)) - (#lua-match? @constructor "^[A-Z]")) + (#lua-match? @constructor "^%u")) ;; Decorators @@ -170,7 +170,7 @@ (comment) @comment @spell ((module . (comment) @preproc) - (#match? @preproc "^#!/")) + (#lua-match? @preproc "^#!/")) (string) @string (escape_sequence) @string.escape @@ -324,14 +324,14 @@ (expression_statement (assignment left: (identifier) @field)))) - (#match? @field "^([A-Z])@!.*$")) + (#lua-match? @field "^%u@!.*$")) ((class_definition body: (block (expression_statement (assignment left: (_ (identifier) @field))))) - (#match? @field "^([A-Z])@!.*$")) + (#lua-match? @field "^%u@!.*$")) ((class_definition (block diff --git a/queries/qmljs/highlights.scm b/queries/qmljs/highlights.scm index 013e135ab..7c0c866d9 100644 --- a/queries/qmljs/highlights.scm +++ b/queries/qmljs/highlights.scm @@ -124,7 +124,7 @@ (predefined_type) @type.builtin ((identifier) @type - (#match? @type "^[A-Z]")) + (#lua-match? @type "^%u")) (type_arguments "<" @punctuation.bracket diff --git a/queries/r/highlights.scm b/queries/r/highlights.scm index ba5835c11..ca784e647 100755 --- a/queries/r/highlights.scm +++ b/queries/r/highlights.scm @@ -13,7 +13,7 @@ (comment) @comment @spell ((program . (comment) @preproc) - (#match? @preproc "^#!/")) + (#lua-match? @preproc "^#!/")) (identifier) @variable diff --git a/queries/racket/highlights.scm b/queries/racket/highlights.scm index 91aa77d9f..bc3c7eb5c 100644 --- a/queries/racket/highlights.scm +++ b/queries/racket/highlights.scm @@ -40,7 +40,7 @@ (symbol) @variable ((symbol) @comment - (#match? @comment "^#[cC][iIsS]$")) + (#lua-match? @comment "^#[cC][iIsS]$")) ;; extension ;; diff --git a/queries/smali/highlights.scm b/queries/smali/highlights.scm index 4f810c293..e9ec9c22c 100644 --- a/queries/smali/highlights.scm +++ b/queries/smali/highlights.scm @@ -82,7 +82,10 @@ (#lua-match? @keyword.return "^return")) ((opcode) @conditional - (#match? @conditional "^(if|cmp)")) + (#lua-match? @conditional "^if")) + +((opcode) @conditional + (#lua-match? @conditional "^cmp")) ((opcode) @exception (#lua-match? @exception "^throw")) diff --git a/queries/starlark/highlights.scm b/queries/starlark/highlights.scm index ab9bfd68d..f318258ac 100644 --- a/queries/starlark/highlights.scm +++ b/queries/starlark/highlights.scm @@ -29,7 +29,7 @@ ((attribute attribute: (identifier) @field) - (#match? @field "^([A-Z])@!.*$")) + (#lua-match? @field "^%u@!.*$")) ((identifier) @type.builtin (#any-of? @type.builtin @@ -148,7 +148,7 @@ (comment) @comment @spell ((module . (comment) @preproc) - (#match? @preproc "^#!/")) + (#lua-match? @preproc "^#!/")) (string) @string [ diff --git a/queries/svelte/highlights.scm b/queries/svelte/highlights.scm index 9877fc7a5..9539f2b51 100644 --- a/queries/svelte/highlights.scm +++ b/queries/svelte/highlights.scm @@ -15,7 +15,7 @@ (#eq? @exception "catch")) ((special_block_keyword) @conditional - (#match? @conditional "^(if|else)$")) + (#any-of? @conditional "if" "else")) [ "{" diff --git a/queries/t32/highlights.scm b/queries/t32/highlights.scm index 9fd1816ba..0e4eb7bd5 100644 --- a/queries/t32/highlights.scm +++ b/queries/t32/highlights.scm @@ -81,7 +81,7 @@ ( (command_expression command: (identifier) @keyword.return) - (#match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$") + (#lua-match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$") ) ; Subroutine calls @@ -97,14 +97,14 @@ (identifier) @constant) ( (argument_list (identifier) @constant.builtin) - (#match? @constant.builtin "^[%/][a-zA-Z][a-zA-Z0-9.]*$") + (#lua-match? @constant.builtin "^[%%/][%l%u][%l%u%d.]*$") ) ( (command_expression command: (identifier) @keyword arguments: (argument_list . (identifier) @label)) - (#match? @keyword "^[gG][oO][tT][oO]$") + (#lua-match? @keyword "^[gG][oO][tT][oO]$") ) (labeled_expression label: (identifier) @label) diff --git a/queries/tiger/highlights.scm b/queries/tiger/highlights.scm index f4256a34c..c0dd7dadf 100644 --- a/queries/tiger/highlights.scm +++ b/queries/tiger/highlights.scm @@ -1,19 +1,19 @@ ; Built-ins {{{ ((function_call function: (identifier) @function.builtin) - (#match? @function.builtin "^(chr|concat|exit|flush|getchar|not|ord|print|print_err|print_int|size|strcmp|streq|substring)$") + (#any-of? @function.builtin "chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size" "strcmp" "streq" "substring") ; FIXME: not supported by neovim ; (#is-not? local) ) ((type_identifier) @type.builtin - (#match? @type.builtin "^(int|string|Object)$") + (#any-of? @type.builtin "int" "string" "Object") ; FIXME: not supported by neovim ; (#is-not? local) ) ((identifier) @variable.builtin - (#match? @variable.builtin "^self$") + (#eq? @variable.builtin "self") ; FIXME: not supported by neovim ; (#is-not? local) ) diff --git a/queries/v/highlights.scm b/queries/v/highlights.scm index c4e69e802..379b525e8 100644 --- a/queries/v/highlights.scm +++ b/queries/v/highlights.scm @@ -31,7 +31,7 @@ (#not-has-parent? @_parent call_expression special_call_expression))) ((identifier) @variable.builtin - (#match? @variable.builtin "^(err|macos|linux|windows)$")) + (#any-of? @variable.builtin "err" "macos" "linux" "windows")) (attribute_declaration) @attribute ;; C: TODO: fixme make `C`.exten highlighted as variable.builtin diff --git a/queries/vala/highlights.scm b/queries/vala/highlights.scm index e1a20b8a0..875bad539 100644 --- a/queries/vala/highlights.scm +++ b/queries/vala/highlights.scm @@ -10,12 +10,12 @@ ; highlight constants ( (member_access_expression (identifier) @constant) - (#match? @constant "^[A-Z][A-Z_0-9]*$") + (#lua-match? @constant "^[%u][%u%d_]*$") ) ( (member_access_expression (member_access_expression) @include (identifier) @constant) - (#match? @constant "^[A-Z][A-Z_0-9]*$") + (#lua-match? @constant "^[%u][%u%d_]*$") ) ; highlight types and probable types @@ -28,7 +28,7 @@ ; highlight creation methods in object creation expressions ( (object_creation_expression (type (symbol (symbol (symbol)? @include (identifier) @type) (identifier) @constructor))) - (#match? @constructor "^[a-z][a-z_0-9]*$") + (#lua-match? @constructor "^[%l][%l%d_]*$") ) (unqualified_type (symbol . (identifier) @type)) diff --git a/queries/vim/highlights.scm b/queries/vim/highlights.scm index ce25b13b9..09188ddb6 100644 --- a/queries/vim/highlights.scm +++ b/queries/vim/highlights.scm @@ -275,7 +275,7 @@ ; Options ((set_value) @number - (#match? @number "^[0-9]+(\.[0-9]+)?$")) + (#lua-match? @number "^[%d]+(%.[%d]+)?$")) (inv_option "!" @operator) (set_item "?" @operator) diff --git a/queries/zig/highlights.scm b/queries/zig/highlights.scm index 37afe1c2f..72d2e642b 100644 --- a/queries/zig/highlights.scm +++ b/queries/zig/highlights.scm @@ -24,7 +24,7 @@ parameter: (IDENTIFIER) @parameter field_access: (IDENTIFIER) parameter: (IDENTIFIER) ] @type - (#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$") + (#lua-match? @type "^%u([%l]+[%u%l%d]*)*$") ) ;; assume camelCase is a function ( @@ -33,7 +33,7 @@ parameter: (IDENTIFIER) @parameter field_access: (IDENTIFIER) parameter: (IDENTIFIER) ] @function - (#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$") + (#lua-match? @function "^%l+([%u][%l%d]*)+$") ) ;; assume all CAPS_1 is a constant @@ -42,7 +42,7 @@ parameter: (IDENTIFIER) @parameter variable_type_function: (IDENTIFIER) field_access: (IDENTIFIER) ] @constant - (#match? @constant "^[A-Z][A-Z_0-9]+$") + (#lua-match? @constant "^%u[%u%d_]+$") ) [ |
