refactor: replace some match & vim-match usages

This commit is contained in:
ObserverOfTime 2023-08-23 14:09:30 +03:00
parent 9ea7559ea9
commit 05fe2c38a3
7 changed files with 15 additions and 18 deletions

View file

@ -101,9 +101,9 @@
; Interop ; Interop
((sym_lit) @method ((sym_lit) @method
(#match? @method "^\\.[^-]")) (#lua-match? @method "^[.][^-]"))
((sym_lit) @field ((sym_lit) @field
(#match? @field "^\\.-")) (#lua-match? @field "^[.]-"))
((sym_lit) @field ((sym_lit) @field
(#lua-match? @field "^[%u].*/.+")) (#lua-match? @field "^[%u].*/.+"))
(list_lit (list_lit
@ -133,7 +133,7 @@
(#any-of? @keyword.coroutine (#any-of? @keyword.coroutine
"alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!")) "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!"))
((sym_lit) @keyword.function ((sym_lit) @keyword.function
(#match? @keyword.function "^(defn|defn-|fn|fn[*])$")) (#any-of? @keyword.function "defn" "defn-" "fn" "fn*"))
; Comment ; Comment
((sym_lit) @comment ((sym_lit) @comment

View file

@ -25,7 +25,7 @@
((primitive_expression ((primitive_expression
(identifier (label) @type) (identifier (label) @type)
(selector (label) @type)) @variable (selector (label) @type)) @variable
(#vim-match? @variable "^[A-Z][^.]*$")) (#lua-match? @variable "^[A-Z][^.]*$"))
;; Parameters ;; Parameters

View file

@ -31,7 +31,5 @@
(extension_storage_class) @storageclass (extension_storage_class) @storageclass
( ((identifier) @variable.builtin
(identifier) @variable.builtin (#lua-match? @variable.builtin "^gl_"))
(#match? @variable.builtin "^gl_")
)

View file

@ -193,18 +193,18 @@
((generic_command ((generic_command
command: (command_name) @_name command: (command_name) @_name
arg: (curly_group (_) @text.emphasis)) arg: (curly_group (_) @text.emphasis))
(#match? @_name "^(\\\\textit|\\\\mathit)$")) (#any-of? @_name "\\textit" "\\mathit"))
((generic_command ((generic_command
command: (command_name) @_name command: (command_name) @_name
arg: (curly_group (_) @text.strong)) arg: (curly_group (_) @text.strong))
(#match? @_name "^(\\\\textbf|\\\\mathbf)$")) (#any-of? @_name "\\textbf" "\\mathbf"))
((generic_command ((generic_command
command: (command_name) @_name command: (command_name) @_name
. .
arg: (curly_group (_) @text.uri)) arg: (curly_group (_) @text.uri))
(#match? @_name "^(\\\\url|\\\\href)$")) (#any-of? @_name "\\url" "\\href"))
;; File inclusion commands ;; File inclusion commands
(class_include (class_include

View file

@ -1,14 +1,14 @@
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: (parameters (string) @injection.content)) parameters: (parameters (string) @injection.content))
(#match? @_name "^#?(not-)?(match|vim-match)$") (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match")
(#set! injection.language "regex") (#set! injection.language "regex")
(#offset! @injection.content 0 1 0 -1)) (#offset! @injection.content 0 1 0 -1))
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: (parameters (string) @injection.content)) parameters: (parameters (string) @injection.content))
(#match? @_name "^#?(not-)?lua-match$") (#any-of? @_name "lua-match" "not-lua-match")
(#set! injection.language "luap") (#set! injection.language "luap")
(#offset! @injection.content 0 1 0 -1)) (#offset! @injection.content 0 1 0 -1))

View file

@ -60,7 +60,7 @@
"next" "next"
] @repeat ] @repeat
(constant) @type (constant) @constant
((identifier) @type.qualifier ((identifier) @type.qualifier
(#any-of? @type.qualifier "private" "protected" "public")) (#any-of? @type.qualifier "private" "protected" "public"))
@ -116,10 +116,10 @@
] @label ] @label
((identifier) @constant.builtin ((identifier) @constant.builtin
(#vim-match? @constant.builtin "^__(callee|dir|id|method|send|ENCODING|FILE|LINE)__$")) (#match? @constant.builtin "^__(callee|dir|id|method|send|ENCODING|FILE|LINE)__$"))
((constant) @type ((constant) @type
(#vim-match? @type "^[A-Z\\d_]+$")) (#not-lua-match? @type "^[A-Z0-9_]+$"))
[ [
(self) (self)

View file

@ -75,8 +75,7 @@
(_ (_ (_ (_ (identifier_ref) @definition.var)))) (_ (_ (_ (_ (identifier_ref) @definition.var))))
(_ (_ (_ (_ (_ (identifier_ref) @definition.var))))) (_ (_ (_ (_ (_ (identifier_ref) @definition.var)))))
] ]
(#vim-match? @definition.var "^(self|pc|stack)$") (#any-of? @definition.var "self" "pc" "stack"))
)
; References ; References
(identifier_ref) @reference (identifier_ref) @reference