mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
Prefer lua-match over match
as string.find is much quicker than vim.regex:match*
This commit is contained in:
parent
89fbb9b39e
commit
011ac894ec
20 changed files with 67 additions and 67 deletions
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
;; Identifier naming conventions
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z].*[a-z]"))
|
||||
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
|
|
@ -64,12 +64,12 @@
|
|||
|
||||
((call
|
||||
function: (identifier) @constructor)
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
(#lua-match? @constructor "^[A-Z]"))
|
||||
|
||||
((call
|
||||
function: (attribute
|
||||
attribute: (identifier) @constructor))
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
(#lua-match? @constructor "^[A-Z]"))
|
||||
|
||||
;; Builtin functions
|
||||
|
||||
|
|
@ -133,7 +133,7 @@
|
|||
(none) @constant.builtin
|
||||
[(true) (false)] @boolean
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^self$"))
|
||||
(#lua-match? @variable.builtin "^self$"))
|
||||
|
||||
(integer) @number
|
||||
(float) @float
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
object: (identifier) @_re)
|
||||
arguments: (argument_list (string) @regex))
|
||||
(#eq? @_re "re")
|
||||
(#match? @regex "^r.*"))
|
||||
(#lua-match? @regex "^r.*"))
|
||||
|
||||
; Module docstring
|
||||
((module . (expression_statement (string) @rst))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue