mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-08 06:20:01 -04:00
perf: remove match where possible
This commit is contained in:
parent
654216eb04
commit
85330918f0
37 changed files with 104 additions and 113 deletions
|
|
@ -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_]+$")
|
||||
)
|
||||
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue