mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-11 16:00:02 -04:00
fix(queries): use vim-match for non lua regexes
This commit is contained in:
parent
4a747aa30c
commit
ce43dbf54c
11 changed files with 29 additions and 29 deletions
|
|
@ -63,13 +63,13 @@
|
||||||
] @constant
|
] @constant
|
||||||
|
|
||||||
((word) @constant
|
((word) @constant
|
||||||
(#match? @constant "SIG(INT|TERM|QUIT|TIN|TOU|STP|HUP)"))
|
(#vim-match? @constant "SIG(INT|TERM|QUIT|TIN|TOU|STP|HUP)"))
|
||||||
|
|
||||||
((word) @boolean
|
((word) @boolean
|
||||||
(#match? @boolean "true|false"))
|
(#vim-match? @boolean "true|false"))
|
||||||
|
|
||||||
((word) @number
|
((word) @number
|
||||||
(#match? @number "^\d*$"))
|
(#vim-match? @number "^\d*$"))
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
(test_operator) @string.
|
(test_operator) @string.
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
argument: [
|
argument: [
|
||||||
(word) @parameter
|
(word) @parameter
|
||||||
((word) @number
|
((word) @number
|
||||||
(#match? @number "^\d*$"))
|
(#vim-match? @number "^\d*$"))
|
||||||
(concatenation (word) @parameter)
|
(concatenation (word) @parameter)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@
|
||||||
|
|
||||||
; when used as an identifier:
|
; when used as an identifier:
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#match? @variable.builtin "^(abstract|as|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|set|static|typedef)$"))
|
(#vim-match? @variable.builtin "^(abstract|as|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|set|static|typedef)$"))
|
||||||
|
|
||||||
["if" "else" "switch" "default"] @conditional
|
["if" "else" "switch" "default"] @conditional
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
(#eq? @constant "_"))
|
(#eq? @constant "_"))
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z\\d_]+$"))
|
(#vim-match? @constant "^[A-Z][A-Z\\d_]+$"))
|
||||||
|
|
||||||
; Function calls
|
; Function calls
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^_*[A-Z][A-Z\d_]+"))
|
(#vim-match? @constant "^_*[A-Z][A-Z\d_]+"))
|
||||||
|
|
||||||
(this) @constant.builtin
|
(this) @constant.builtin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,17 +13,17 @@
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
(#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||||
|
|
||||||
((shorthand_property_identifier) @constant
|
((shorthand_property_identifier) @constant
|
||||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
(#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||||
|
|
||||||
((identifier) @constructor
|
((identifier) @constructor
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#not-is? @variable.builtin import var parameter)
|
(#not-is? @variable.builtin import var parameter)
|
||||||
(#match? @variable.builtin "^(arguments|module|console|window|document)$"))
|
(#vim-match? @variable.builtin "^(arguments|module|console|window|document)$"))
|
||||||
|
|
||||||
((identifier) @function.builtin
|
((identifier) @function.builtin
|
||||||
(#not-is? @function.builtin import var parameter)
|
(#not-is? @function.builtin import var parameter)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
(relative_scope) @variable.builtin
|
(relative_scope) @variable.builtin
|
||||||
|
|
||||||
((name) @constant
|
((name) @constant
|
||||||
(#match? @constant "^_?[A-Z][A-Z\d_]+$"))
|
(#vim-match? @constant "^_?[A-Z][A-Z\d_]+$"))
|
||||||
|
|
||||||
((name) @constructor
|
((name) @constructor
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#match? @constructor "^[A-Z]"))
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (identifier) @function.builtin)
|
function: (identifier) @function.builtin)
|
||||||
(match?
|
(vim-match?
|
||||||
@function.builtin
|
@function.builtin
|
||||||
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
|
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
parameters: (parameters
|
parameters: (parameters
|
||||||
(identifier) @self) )
|
(identifier) @self) )
|
||||||
(eq? @self "self")
|
(eq? @self "self")
|
||||||
(match? @constructor "(__new__|__init__)"))
|
(vim-match? @constructor "(__new__|__init__)"))
|
||||||
|
|
||||||
(type (identifier) @type)
|
(type (identifier) @type)
|
||||||
(type
|
(type
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
((directive
|
((directive
|
||||||
name: (type) @function.builtin)
|
name: (type) @function.builtin)
|
||||||
(#match?
|
(#vim-match?
|
||||||
@function.builtin
|
@function.builtin
|
||||||
; https://docutils.sourceforge.io/docs/ref/rst/directives.html
|
; https://docutils.sourceforge.io/docs/ref/rst/directives.html
|
||||||
"^(attention|caution|danger|error|hint|important|note|tip|warning|admonition)|(image|figure)|(topic|sidebar|line-block|parsed-literal|code|math|rubric|epigraph|highlights|pull-quote|compound|container)|(table|csv-table|list-table)|(contents|sectnum|section-numbering|header|footer)|(target-notes)|(meta)|(replace|unicode|date)|(raw|class|role|default-role|title|restructuredtext-test-directive)::$"))
|
"^(attention|caution|danger|error|hint|important|note|tip|warning|admonition)|(image|figure)|(topic|sidebar|line-block|parsed-literal|code|math|rubric|epigraph|highlights|pull-quote|compound|container)|(table|csv-table|list-table)|(contents|sectnum|section-numbering|header|footer)|(target-notes)|(meta)|(replace|unicode|date)|(raw|class|role|default-role|title|restructuredtext-test-directive)::$"))
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
(role) @function
|
(role) @function
|
||||||
|
|
||||||
((role) @function.builtin
|
((role) @function.builtin
|
||||||
(#match?
|
(#vim-match?
|
||||||
@function.builtin
|
@function.builtin
|
||||||
; https://docutils.sourceforge.io/docs/ref/rst/roles.html
|
; https://docutils.sourceforge.io/docs/ref/rst/roles.html
|
||||||
"^:(emphasis|literal|code|math|pep-reference|PEP|rfc-reference|RFC|strong|subscript|sub|superscript|sup|title-reference|title|t|raw):$"))
|
"^:(emphasis|literal|code|math|pep-reference|PEP|rfc-reference|RFC|strong|subscript|sub|superscript|sup|title-reference|title|t|raw):$"))
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
|
|
||||||
((identifier) @keyword
|
((identifier) @keyword
|
||||||
(#match? @keyword "^(private|protected|public)$"))
|
(#vim-match? @keyword "^(private|protected|public)$"))
|
||||||
|
|
||||||
; Function calls
|
; Function calls
|
||||||
|
|
||||||
|
|
@ -89,10 +89,10 @@
|
||||||
] @label
|
] @label
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
|
(#vim-match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
|
||||||
|
|
||||||
((constant) @constant.macro
|
((constant) @constant.macro
|
||||||
(#match? @constant.macro "^[A-Z\\d_]+$"))
|
(#vim-match? @constant.macro "^[A-Z\\d_]+$"))
|
||||||
|
|
||||||
(constant) @constant
|
(constant) @constant
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
; Assume all-caps names are constants
|
; Assume all-caps names are constants
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
(#vim-match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
||||||
|
|
||||||
; Other identifiers
|
; Other identifiers
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue