aboutsummaryrefslogtreecommitdiffstats
path: root/queries/python
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2021-11-18 09:51:03 +0000
committerStephan Seitz <stephan.seitz@fau.de>2021-11-23 10:02:06 +0100
commit011ac894ec5b9e36563d8629fb7734f43ddb27a8 (patch)
treede0b252b7705bfa4304c08cd389fed0814ae6f1c /queries/python
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.gz
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.bz2
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.lz
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.xz
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.zst
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.zip
Prefer lua-match over match
as string.find is much quicker than vim.regex:match*
Diffstat (limited to 'queries/python')
-rw-r--r--queries/python/highlights.scm12
-rw-r--r--queries/python/injections.scm2
2 files changed, 7 insertions, 7 deletions
diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm
index 318780d18..423948e51 100644
--- a/queries/python/highlights.scm
+++ b/queries/python/highlights.scm
@@ -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
diff --git a/queries/python/injections.scm b/queries/python/injections.scm
index 197e725e5..db966e6ca 100644
--- a/queries/python/injections.scm
+++ b/queries/python/injections.scm
@@ -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))