mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17: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
|
|
@ -26,7 +26,7 @@
|
|||
] @operator
|
||||
|
||||
[
|
||||
(string)
|
||||
(string)
|
||||
(raw_string)
|
||||
(heredoc_body)
|
||||
] @string
|
||||
|
|
@ -58,18 +58,18 @@
|
|||
] @keyword
|
||||
|
||||
[
|
||||
(special_variable_name)
|
||||
(special_variable_name)
|
||||
("$" (special_variable_name))
|
||||
] @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
|
||||
(#match? @boolean "true|false"))
|
||||
(#vim-match? @boolean "true|false"))
|
||||
|
||||
((word) @number
|
||||
(#match? @number "^\d*$"))
|
||||
(#vim-match? @number "^\d*$"))
|
||||
|
||||
(comment) @comment
|
||||
(test_operator) @string.
|
||||
|
|
@ -83,11 +83,11 @@
|
|||
|
||||
(command_name (word)) @function
|
||||
|
||||
(command
|
||||
(command
|
||||
argument: [
|
||||
(word) @parameter
|
||||
((word) @number
|
||||
(#match? @number "^\d*$"))
|
||||
(#vim-match? @number "^\d*$"))
|
||||
(concatenation (word) @parameter)
|
||||
])
|
||||
|
||||
|
|
@ -98,12 +98,12 @@
|
|||
|
||||
("$" (variable_name)) @identifier
|
||||
|
||||
(expansion
|
||||
(expansion
|
||||
[ "${" "}" ] @punctuation.bracket)
|
||||
|
||||
(variable_name) @identifier
|
||||
|
||||
(case_item
|
||||
(case_item
|
||||
value: (word) @parameter)
|
||||
|
||||
(concatenation (word) @parameter)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
"|="
|
||||
"~="
|
||||
"$="
|
||||
"*="
|
||||
"*="
|
||||
"and"
|
||||
"or"
|
||||
"not"
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
; when used as an identifier:
|
||||
((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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
;; Forked from tree-sitter-go
|
||||
;; Forked from tree-sitter-go
|
||||
;; Copyright (c) 2014 Max Brunsfeld (The MIT License)
|
||||
|
||||
;;
|
||||
|
|
@ -12,10 +12,10 @@
|
|||
(variadic_parameter_declaration (identifier) @parameter)
|
||||
|
||||
((identifier) @constant
|
||||
(#eq? @constant "_"))
|
||||
(#eq? @constant "_"))
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]+$"))
|
||||
(#vim-match? @constant "^[A-Z][A-Z\\d_]+$"))
|
||||
|
||||
; Function calls
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@
|
|||
; Variables
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\d_]+"))
|
||||
(#vim-match? @constant "^_*[A-Z][A-Z\d_]+"))
|
||||
|
||||
(this) @constant.builtin
|
||||
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@
|
|||
(identifier) @variable
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||
(#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||
|
||||
((shorthand_property_identifier) @constant
|
||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||
(#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||
|
||||
((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#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
|
||||
(#not-is? @function.builtin import var parameter)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
(relative_scope) @variable.builtin
|
||||
|
||||
((name) @constant
|
||||
(#match? @constant "^_?[A-Z][A-Z\d_]+$"))
|
||||
(#vim-match? @constant "^_?[A-Z][A-Z\d_]+$"))
|
||||
|
||||
((name) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
((call
|
||||
function: (identifier) @function.builtin)
|
||||
(match?
|
||||
(vim-match?
|
||||
@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__)$"))
|
||||
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
parameters: (parameters
|
||||
(identifier) @self) )
|
||||
(eq? @self "self")
|
||||
(match? @constructor "(__new__|__init__)"))
|
||||
(vim-match? @constructor "(__new__|__init__)"))
|
||||
|
||||
(type (identifier) @type)
|
||||
(type
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
((directive
|
||||
name: (type) @function.builtin)
|
||||
(#match?
|
||||
(#vim-match?
|
||||
@function.builtin
|
||||
; 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)::$"))
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
(role) @function
|
||||
|
||||
((role) @function.builtin
|
||||
(#match?
|
||||
(#vim-match?
|
||||
@function.builtin
|
||||
; 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):$"))
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
|
||||
((identifier) @keyword
|
||||
(#match? @keyword "^(private|protected|public)$"))
|
||||
(#vim-match? @keyword "^(private|protected|public)$"))
|
||||
|
||||
; Function calls
|
||||
|
||||
|
|
@ -85,14 +85,14 @@
|
|||
; Identifiers
|
||||
[
|
||||
(class_variable)
|
||||
(instance_variable)
|
||||
(instance_variable)
|
||||
] @label
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
|
||||
(#vim-match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
|
||||
|
||||
((constant) @constant.macro
|
||||
(#match? @constant.macro "^[A-Z\\d_]+$"))
|
||||
(#vim-match? @constant.macro "^[A-Z\\d_]+$"))
|
||||
|
||||
(constant) @constant
|
||||
|
||||
|
|
@ -175,7 +175,7 @@
|
|||
"{"
|
||||
"}"
|
||||
"%w("
|
||||
"%i("
|
||||
"%i("
|
||||
] @punctuation.bracket
|
||||
|
||||
(ERROR) @error
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
; Assume all-caps names are constants
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
||||
(#vim-match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
||||
|
||||
; Other identifiers
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue