mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 01:40:02 -04:00
Use #any-of? instead of #match? where posible
This commit is contained in:
parent
55c5620aa3
commit
c699cc2e47
9 changed files with 31 additions and 15 deletions
|
|
@ -90,7 +90,9 @@
|
||||||
(command_name (word) @function)
|
(command_name (word) @function)
|
||||||
|
|
||||||
((command_name (word) @function.builtin)
|
((command_name (word) @function.builtin)
|
||||||
(#match? @function.builtin "^(cd|echo|eval|exit|getopts|pushd|popd|return|set|shift)$"))
|
(#any-of? @function.builtin
|
||||||
|
"cd" "echo" "eval" "exit" "getopts"
|
||||||
|
"pushd" "popd" "return" "set" "shift"))
|
||||||
|
|
||||||
(command
|
(command
|
||||||
argument: [
|
argument: [
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,11 @@
|
||||||
(sym_lit) @function.macro
|
(sym_lit) @function.macro
|
||||||
.
|
.
|
||||||
(sym_lit) @function
|
(sym_lit) @function
|
||||||
(#match? @function.macro "^(declare|def|definline|definterface|defmacro|defmethod|defmulti|defn|defn-|defonce|defprotocol|defstruct|deftype|ns)$"))
|
(#any-of? @function.macro
|
||||||
|
"declare" "def" "definline" "definterface"
|
||||||
|
"defmacro" "defmethod" "defmulti" "defn"
|
||||||
|
"defn-" "defonce" "defprotocol" "defstruct"
|
||||||
|
"deftype" "ns"))
|
||||||
|
|
||||||
;; other macros
|
;; other macros
|
||||||
(list_lit
|
(list_lit
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,16 @@
|
||||||
(tag (name) @text.note (user)? @constant)
|
(tag (name) @text.note (user)? @constant)
|
||||||
|
|
||||||
((tag ((name) @text.warning))
|
((tag ((name) @text.warning))
|
||||||
(#match? @text.warning "^(TODO|HACK|WARNING)$"))
|
(#any-of? @text.warning "TODO" "HACK" "WARNING)$"))
|
||||||
|
|
||||||
("text" @text.warning
|
("text" @text.warning
|
||||||
(#match? @text.warning "^(TODO|HACK|WARNING)$"))
|
(#any-of? @text.warning "TODO" "HACK" "WARNING"))
|
||||||
|
|
||||||
((tag ((name) @text.danger))
|
((tag ((name) @text.danger))
|
||||||
(#match? @text.danger "^(FIXME|XXX|BUG)$"))
|
(#any-of? @text.danger "FIXME" "XXX" "BUG"))
|
||||||
|
|
||||||
("text" @text.danger
|
("text" @text.danger
|
||||||
(#match? @text.danger "^(FIXME|XXX|BUG)$"))
|
(#any-of? @text.danger "FIXME" "XXX" "BUG"))
|
||||||
|
|
||||||
; Issue number (#123)
|
; Issue number (#123)
|
||||||
("text" @number (#match? @number "^#[0-9]+$"))
|
("text" @number (#match? @number "^#[0-9]+$"))
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
; If the identifier is just "yield" or "outlet", it's a keyword
|
; If the identifier is just "yield" or "outlet", it's a keyword
|
||||||
((mustache_statement (identifier) @keyword)
|
((mustache_statement (identifier) @keyword)
|
||||||
(#match? @keyword "yield|outlet"))
|
(#any-of? @keyword "yield" "outlet"))
|
||||||
|
|
||||||
; Helpers are functions
|
; Helpers are functions
|
||||||
((helper_invocation helper: [
|
((helper_invocation helper: [
|
||||||
|
|
|
||||||
|
|
@ -109,13 +109,20 @@
|
||||||
;; Builtin types
|
;; Builtin types
|
||||||
|
|
||||||
((type_identifier) @type.builtin
|
((type_identifier) @type.builtin
|
||||||
(#match? @type.builtin "^(bool|byte|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$"))
|
(#any-of? @type.builtin
|
||||||
|
"bool" "byte" "complex128" "complex64" "error"
|
||||||
|
"float32" "float64" "int" "int16" "int32" "int64"
|
||||||
|
"int8" "rune" "string" "uint" "uint16" "uint32"
|
||||||
|
"uint64" "uint8" "uintptr"))
|
||||||
|
|
||||||
|
|
||||||
;; Builtin functions
|
;; Builtin functions
|
||||||
|
|
||||||
((identifier) @function.builtin
|
((identifier) @function.builtin
|
||||||
(#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
|
(#any-of? @function.builtin
|
||||||
|
"append" "cap" "close" "complex" "copy"
|
||||||
|
"delete" "imag" "len" "make" "new" "panic"
|
||||||
|
"print" "println" "real" "recover"))
|
||||||
|
|
||||||
|
|
||||||
; Delimiters
|
; Delimiters
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@
|
||||||
"type"
|
"type"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
((identifier) @keyword (#match? @keyword "^(global|local)$"))
|
((identifier) @keyword (#any-of? @keyword "global" "local"))
|
||||||
|
|
||||||
(compound_expression
|
(compound_expression
|
||||||
["begin" "end"] @keyword)
|
["begin" "end"] @keyword)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@
|
||||||
|
|
||||||
(
|
(
|
||||||
(type_constructor) @type.builtin
|
(type_constructor) @type.builtin
|
||||||
(#match? @type.builtin "^(int|char|bytes|string|float|bool|unit|exn|array|list|option|int32|int64|nativeint|format6|lazy_t)$")
|
(#any-of? @type.builtin
|
||||||
|
"int" "char" "bytes" "string" "float"
|
||||||
|
"bool" "unit" "exn" "array" "list" "option"
|
||||||
|
"int32" "int64" "nativeint" "format6" "lazy_t")
|
||||||
)
|
)
|
||||||
|
|
||||||
[(class_name) (class_type_name) (type_constructor)] @type
|
[(class_name) (class_type_name) (type_constructor)] @type
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
(attribute
|
(attribute
|
||||||
(quoted_attribute_value (attribute_value) @_lang)))
|
(quoted_attribute_value (attribute_value) @_lang)))
|
||||||
(raw_text) @scss)
|
(raw_text) @scss)
|
||||||
(#match? @_lang "(scss|postcss|less)")
|
(#any-of? @_lang "scss" "postcss" "less")
|
||||||
)
|
)
|
||||||
|
|
||||||
((attribute
|
((attribute
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
(attribute
|
(attribute
|
||||||
(quoted_attribute_value (attribute_value) @_lang)))
|
(quoted_attribute_value (attribute_value) @_lang)))
|
||||||
(raw_text) @typescript)
|
(raw_text) @typescript)
|
||||||
(#match? @_lang "(ts|typescript)")
|
(#any-of? @_lang "ts" "typescript")
|
||||||
)
|
)
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
(attribute
|
(attribute
|
||||||
(quoted_attribute_value (attribute_value) @_lang)))
|
(quoted_attribute_value (attribute_value) @_lang)))
|
||||||
(raw_text) @scss)
|
(raw_text) @scss)
|
||||||
(#match? @_lang "(scss|postcss|less)")
|
(#any-of? @_lang "scss" "postcss" "less")
|
||||||
)
|
)
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
(attribute
|
(attribute
|
||||||
(quoted_attribute_value (attribute_value) @_lang)))
|
(quoted_attribute_value (attribute_value) @_lang)))
|
||||||
(raw_text) @typescript)
|
(raw_text) @typescript)
|
||||||
(#match? @_lang "(ts|typescript)")
|
(#any-of? @_lang "ts" "typescript")
|
||||||
)
|
)
|
||||||
|
|
||||||
((interpolation
|
((interpolation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue