mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 03:40:04 -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
|
|
@ -102,7 +102,7 @@
|
||||||
])
|
])
|
||||||
|
|
||||||
((word) @number
|
((word) @number
|
||||||
(#match? @number "^[0-9]+$"))
|
(#lua-match? @number "^[0-9]+$"))
|
||||||
|
|
||||||
(file_redirect
|
(file_redirect
|
||||||
descriptor: (file_descriptor) @operator
|
descriptor: (file_descriptor) @operator
|
||||||
|
|
@ -114,7 +114,7 @@
|
||||||
(variable_name) @variable
|
(variable_name) @variable
|
||||||
|
|
||||||
((variable_name) @constant
|
((variable_name) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
(case_item
|
(case_item
|
||||||
value: (word) @parameter)
|
value: (word) @parameter)
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@
|
||||||
(sizeof_expression value: (parenthesized_expression (identifier) @type))
|
(sizeof_expression value: (parenthesized_expression (identifier) @type))
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z0-9_]+$"))
|
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||||
|
|
||||||
;; Preproc def / undef
|
;; Preproc def / undef
|
||||||
(preproc_def
|
(preproc_def
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
; Used in destructure pattern
|
; Used in destructure pattern
|
||||||
((sym_lit) @parameter
|
((sym_lit) @parameter
|
||||||
(#match? @parameter "^[&]"))
|
(#lua-match? @parameter "^[&]"))
|
||||||
|
|
||||||
; Inline function variables
|
; Inline function variables
|
||||||
((sym_lit) @variable.builtin
|
((sym_lit) @variable.builtin
|
||||||
|
|
@ -106,7 +106,7 @@
|
||||||
|
|
||||||
; Definition functions
|
; Definition functions
|
||||||
((sym_lit) @keyword
|
((sym_lit) @keyword
|
||||||
(#match? @keyword "^def.*$"))
|
(#lua-match? @keyword "^def.*$"))
|
||||||
((sym_lit) @keyword
|
((sym_lit) @keyword
|
||||||
(#eq? @keyword "declare"))
|
(#eq? @keyword "declare"))
|
||||||
((sym_lit) @keyword.function
|
((sym_lit) @keyword.function
|
||||||
|
|
@ -283,7 +283,7 @@
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(sym_lit) @_keyword ; Don't really want to highlight twice
|
(sym_lit) @_keyword ; Don't really want to highlight twice
|
||||||
(#match? @_keyword "^def.*")
|
(#lua-match? @_keyword "^def.*")
|
||||||
.
|
.
|
||||||
(sym_lit)
|
(sym_lit)
|
||||||
.
|
.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,6 @@
|
||||||
(#any-of? @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 (#lua-match? @number "^#[0-9]+$"))
|
||||||
; User mention (@user)
|
; User mention (@user)
|
||||||
("text" @constant (#match? @constant "^[@][a-zA-Z0-9_-]+$"))
|
("text" @constant (#lua-match? @constant "^[@][a-zA-Z0-9_-]+$"))
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@
|
||||||
|
|
||||||
(namespace_identifier) @namespace
|
(namespace_identifier) @namespace
|
||||||
((namespace_identifier) @type
|
((namespace_identifier) @type
|
||||||
(#match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
((namespace_identifier) @constant
|
((namespace_identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
(namespace_definition
|
(namespace_definition
|
||||||
name: (identifier) @namespace)
|
name: (identifier) @namespace)
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
((function_declarator
|
((function_declarator
|
||||||
declarator: (qualified_identifier
|
declarator: (qualified_identifier
|
||||||
name: (identifier) @constructor))
|
name: (identifier) @constructor))
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
(operator_name) @function
|
(operator_name) @function
|
||||||
"static_assert" @function.builtin
|
"static_assert" @function.builtin
|
||||||
|
|
@ -65,22 +65,22 @@
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @constructor)
|
function: (identifier) @constructor)
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (qualified_identifier
|
function: (qualified_identifier
|
||||||
name: (identifier) @constructor))
|
name: (identifier) @constructor))
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (field_expression
|
function: (field_expression
|
||||||
field: (field_identifier) @constructor))
|
field: (field_identifier) @constructor))
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
;; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
;; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
||||||
((field_initializer
|
((field_initializer
|
||||||
(field_identifier) @constructor
|
(field_identifier) @constructor
|
||||||
(argument_list))
|
(argument_list))
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
|
|
||||||
; Constants
|
; Constants
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,6 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
((variable) @constant
|
((variable) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@
|
||||||
;--------------------
|
;--------------------
|
||||||
|
|
||||||
((identifier) @constructor
|
((identifier) @constructor
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
(#lua-match? @constant "^[A-Z_][A-Z%d_]+$"))
|
||||||
|
|
||||||
((shorthand_property_identifier) @constant
|
((shorthand_property_identifier) @constant
|
||||||
(#vim-match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
(#lua-match? @constant "^[A-Z_][A-Z%d_]+$"))
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#vim-match? @variable.builtin "^(arguments|module|console|window|document)$"))
|
(#vim-match? @variable.builtin "^(arguments|module|console|window|document)$"))
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,11 @@
|
||||||
|
|
||||||
;; Identifier naming conventions
|
;; Identifier naming conventions
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(#match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(#match? @type "^[A-Z][A-Z_0-9]*$") . (_))
|
(#lua-match? @type "^[A-Z][A-Z_0-9]*$") . (_))
|
||||||
|
|
||||||
;; Functions
|
;; Functions
|
||||||
(constructor_definition) @constructor
|
(constructor_definition) @constructor
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
(#match? @tag "^(:)?[a-z]"))
|
(#match? @tag "^(:)?[a-z]"))
|
||||||
; Tags that start with a capital letter are Glimmer components
|
; Tags that start with a capital letter are Glimmer components
|
||||||
((tag_name) @constructor
|
((tag_name) @constructor
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
(attribute_name) @property
|
(attribute_name) @property
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
(block_statement_start path: (identifier) @conditional)
|
(block_statement_start path: (identifier) @conditional)
|
||||||
(block_statement_end path: (identifier) @conditional)
|
(block_statement_end path: (identifier) @conditional)
|
||||||
((mustache_statement (identifier) @conditional)
|
((mustache_statement (identifier) @conditional)
|
||||||
(#match? @conditional "else"))
|
(#lua-match? @conditional "else"))
|
||||||
|
|
||||||
; == Mustache Statements ===
|
; == Mustache Statements ===
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
(#not-match? @variable "this"))
|
(#not-match? @variable "this"))
|
||||||
; `this` should be highlighted as a built-in variable
|
; `this` should be highlighted as a built-in variable
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#match? @variable.builtin "this"))
|
(#lua-match? @variable.builtin "this"))
|
||||||
|
|
||||||
; 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)
|
||||||
|
|
@ -67,9 +67,9 @@
|
||||||
])
|
])
|
||||||
(#not-match? @function "if|yield"))
|
(#not-match? @function "if|yield"))
|
||||||
((helper_invocation helper: (identifier) @conditional)
|
((helper_invocation helper: (identifier) @conditional)
|
||||||
(#match? @conditional "if"))
|
(#lua-match? @conditional "if"))
|
||||||
((helper_invocation helper: (identifier) @keyword)
|
((helper_invocation helper: (identifier) @keyword)
|
||||||
(#match? @keyword "yield"))
|
(#lua-match? @keyword "yield"))
|
||||||
|
|
||||||
(hash_pair key: (identifier) @property)
|
(hash_pair key: (identifier) @property)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,10 +95,10 @@
|
||||||
|
|
||||||
((field_access
|
((field_access
|
||||||
object: (identifier) @type)
|
object: (identifier) @type)
|
||||||
(#match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
((scoped_identifier
|
((scoped_identifier
|
||||||
scope: (identifier) @type)
|
scope: (identifier) @type)
|
||||||
(#match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
; Fields
|
; Fields
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z_][A-Z\d_]+$"))
|
(#lua-match? @constant "^[A-Z_][A-Z%d_]+$"))
|
||||||
|
|
||||||
(this) @variable.builtin
|
(this) @variable.builtin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,19 @@
|
||||||
name: (identifier) @tag)
|
name: (identifier) @tag)
|
||||||
|
|
||||||
(jsx_opening_element ((identifier) @constructor
|
(jsx_opening_element ((identifier) @constructor
|
||||||
(#match? @constructor "^[A-Z]")))
|
(#lua-match? @constructor "^[A-Z]")))
|
||||||
|
|
||||||
; Handle the dot operator effectively - <My.Component>
|
; Handle the dot operator effectively - <My.Component>
|
||||||
(jsx_opening_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
|
(jsx_opening_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
|
||||||
|
|
||||||
(jsx_closing_element ((identifier) @constructor
|
(jsx_closing_element ((identifier) @constructor
|
||||||
(#match? @constructor "^[A-Z]")))
|
(#lua-match? @constructor "^[A-Z]")))
|
||||||
|
|
||||||
; Handle the dot operator effectively - </My.Component>
|
; Handle the dot operator effectively - </My.Component>
|
||||||
(jsx_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
|
(jsx_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
|
||||||
|
|
||||||
(jsx_self_closing_element ((identifier) @constructor
|
(jsx_self_closing_element ((identifier) @constructor
|
||||||
(#match? @constructor "^[A-Z]")))
|
(#lua-match? @constructor "^[A-Z]")))
|
||||||
|
|
||||||
; Handle the dot operator effectively - <My.Component />
|
; Handle the dot operator effectively - <My.Component />
|
||||||
(jsx_self_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
|
(jsx_self_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@
|
||||||
(nil) @constant.builtin
|
(nil) @constant.builtin
|
||||||
(spread) @constant ;; "..."
|
(spread) @constant ;; "..."
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
;; Functions
|
;; Functions
|
||||||
(function [(function_name) (identifier)] @function)
|
(function [(function_name) (identifier)] @function)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(#eq? @_cdef_identifier "cdef")
|
(#eq? @_cdef_identifier "cdef")
|
||||||
(#match? @c "^[\"']")
|
(#lua-match? @c "^[\"']")
|
||||||
(#offset! @c 0 1 0 -1)
|
(#offset! @c 0 1 0 -1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(#eq? @_cdef_identifier "cdef")
|
(#eq? @_cdef_identifier "cdef")
|
||||||
(#match? @c "^\\[\\[")
|
(#lua-match? @c "^%[%[")
|
||||||
(#offset! @c 0 2 0 -2)
|
(#offset! @c 0 2 0 -2)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec")
|
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec")
|
||||||
(#match? @vim "^[\"']")
|
(#lua-match? @vim "^[\"']")
|
||||||
(#offset! @vim 0 1 0 -1)
|
(#offset! @vim 0 1 0 -1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec")
|
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec")
|
||||||
(#match? @vim "^\\[\\[")
|
(#lua-match? @vim "^%[%[")
|
||||||
(#offset! @vim 0 2 0 -2)
|
(#offset! @vim 0 2 0 -2)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
(#vim-match? @constant "^_?[A-Z][A-Z\d_]+$"))
|
(#vim-match? @constant "^_?[A-Z][A-Z\d_]+$"))
|
||||||
|
|
||||||
((name) @constructor
|
((name) @constructor
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
((name) @variable.builtin
|
((name) @variable.builtin
|
||||||
(#eq? @variable.builtin "this"))
|
(#eq? @variable.builtin "this"))
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@
|
||||||
|
|
||||||
;; Identifier naming conventions
|
;; Identifier naming conventions
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(#match? @type "^[A-Z].*[a-z]"))
|
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#any-of? @constant.builtin
|
(#any-of? @constant.builtin
|
||||||
|
|
@ -64,12 +64,12 @@
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (identifier) @constructor)
|
function: (identifier) @constructor)
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (attribute
|
function: (attribute
|
||||||
attribute: (identifier) @constructor))
|
attribute: (identifier) @constructor))
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
;; Builtin functions
|
;; Builtin functions
|
||||||
|
|
||||||
|
|
@ -133,7 +133,7 @@
|
||||||
(none) @constant.builtin
|
(none) @constant.builtin
|
||||||
[(true) (false)] @boolean
|
[(true) (false)] @boolean
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#match? @variable.builtin "^self$"))
|
(#lua-match? @variable.builtin "^self$"))
|
||||||
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
(float) @float
|
(float) @float
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
object: (identifier) @_re)
|
object: (identifier) @_re)
|
||||||
arguments: (argument_list (string) @regex))
|
arguments: (argument_list (string) @regex))
|
||||||
(#eq? @_re "re")
|
(#eq? @_re "re")
|
||||||
(#match? @regex "^r.*"))
|
(#lua-match? @regex "^r.*"))
|
||||||
|
|
||||||
; Module docstring
|
; Module docstring
|
||||||
((module . (expression_statement (string) @rst))
|
((module . (expression_statement (string) @rst))
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@
|
||||||
|
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(#match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
(const_item
|
(const_item
|
||||||
name: (identifier) @constant)
|
name: (identifier) @constant)
|
||||||
; Assume all-caps names are constants
|
; Assume all-caps names are constants
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
|
||||||
|
|
||||||
; Other identifiers
|
; Other identifiers
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
; Assume other uppercase names are enum constructors
|
; Assume other uppercase names are enum constructors
|
||||||
((field_identifier) @constant
|
((field_identifier) @constant
|
||||||
(#match? @constant "^[A-Z]"))
|
(#lua-match? @constant "^[A-Z]"))
|
||||||
|
|
||||||
(enum_variant
|
(enum_variant
|
||||||
name: (identifier) @constant)
|
name: (identifier) @constant)
|
||||||
|
|
@ -62,10 +62,10 @@
|
||||||
name: (identifier) @namespace))
|
name: (identifier) @namespace))
|
||||||
((scoped_identifier
|
((scoped_identifier
|
||||||
path: (identifier) @type)
|
path: (identifier) @type)
|
||||||
(#match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
((scoped_identifier
|
((scoped_identifier
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
(#match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
(crate) @namespace
|
(crate) @namespace
|
||||||
(scoped_use_list
|
(scoped_use_list
|
||||||
|
|
@ -74,25 +74,25 @@
|
||||||
path: (scoped_identifier
|
path: (scoped_identifier
|
||||||
(identifier) @namespace))
|
(identifier) @namespace))
|
||||||
(use_list (scoped_identifier (identifier) @namespace . (_)))
|
(use_list (scoped_identifier (identifier) @namespace . (_)))
|
||||||
(use_list (identifier) @type (#match? @type "^[A-Z]"))
|
(use_list (identifier) @type (#lua-match? @type "^[A-Z]"))
|
||||||
(use_as_clause alias: (identifier) @type (#match? @type "^[A-Z]"))
|
(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
;; Correct enum constructors
|
;; Correct enum constructors
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (scoped_identifier
|
function: (scoped_identifier
|
||||||
"::"
|
"::"
|
||||||
name: (identifier) @constant)
|
name: (identifier) @constant)
|
||||||
(#match? @constant "^[A-Z]"))
|
(#lua-match? @constant "^[A-Z]"))
|
||||||
|
|
||||||
; Assume uppercase names in a match arm are constants.
|
; Assume uppercase names in a match arm are constants.
|
||||||
((match_arm
|
((match_arm
|
||||||
pattern: (match_pattern (identifier) @constant))
|
pattern: (match_pattern (identifier) @constant))
|
||||||
(#match? @constant "^[A-Z]"))
|
(#lua-match? @constant "^[A-Z]"))
|
||||||
((match_arm
|
((match_arm
|
||||||
pattern: (match_pattern
|
pattern: (match_pattern
|
||||||
(scoped_identifier
|
(scoped_identifier
|
||||||
name: (identifier) @constant)))
|
name: (identifier) @constant)))
|
||||||
(#match? @constant "^[A-Z]"))
|
(#lua-match? @constant "^[A-Z]"))
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#match? @variable.builtin "^this$"))
|
(#lua-match? @variable.builtin "^this$"))
|
||||||
|
|
||||||
(interpolation) @none
|
(interpolation) @none
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
; an uppercased method as a constant if used with no params.
|
; an uppercased method as a constant if used with no params.
|
||||||
; Introducing highlighting for those specific cases, is probably
|
; Introducing highlighting for those specific cases, is probably
|
||||||
; best way to resolve the issue.
|
; best way to resolve the issue.
|
||||||
((identifier) @constant (#match? @constant "^[A-Z]"))
|
((identifier) @constant (#lua-match? @constant "^[A-Z]"))
|
||||||
|
|
||||||
;; types
|
;; types
|
||||||
|
|
||||||
|
|
@ -56,10 +56,10 @@
|
||||||
((stable_identifier (identifier) @namespace))
|
((stable_identifier (identifier) @namespace))
|
||||||
|
|
||||||
((import_declaration
|
((import_declaration
|
||||||
path: (identifier) @type) (#match? @type "^[A-Z]"))
|
path: (identifier) @type) (#lua-match? @type "^[A-Z]"))
|
||||||
((stable_identifier (identifier) @type) (#match? @type "^[A-Z]"))
|
((stable_identifier (identifier) @type) (#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
((import_selectors (identifier) @type) (#match? @type "^[A-Z]"))
|
((import_selectors (identifier) @type) (#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
; method invocation
|
; method invocation
|
||||||
|
|
||||||
|
|
@ -73,14 +73,14 @@
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @constructor)
|
function: (identifier) @constructor)
|
||||||
(#match? @constructor "^[A-Z]"))
|
(#lua-match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
(generic_function
|
(generic_function
|
||||||
function: (identifier) @function)
|
function: (identifier) @function)
|
||||||
|
|
||||||
(
|
(
|
||||||
(identifier) @function.builtin
|
(identifier) @function.builtin
|
||||||
(#match? @function.builtin "^super$")
|
(#lua-match? @function.builtin "^super$")
|
||||||
)
|
)
|
||||||
|
|
||||||
; function definitions
|
; function definitions
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
|
|
||||||
(field_expression field: (identifier) @property)
|
(field_expression field: (identifier) @property)
|
||||||
(field_expression value: (identifier) @type
|
(field_expression value: (identifier) @type
|
||||||
(#match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
(infix_expression operator: (identifier) @operator)
|
(infix_expression operator: (identifier) @operator)
|
||||||
(infix_expression operator: (operator_identifier) @operator)
|
(infix_expression operator: (operator_identifier) @operator)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(#eq? @_cdef_identifier "cdef")
|
(#eq? @_cdef_identifier "cdef")
|
||||||
(#match? @c "^[\"']")
|
(#lua-match? @c "^[\"']")
|
||||||
(#offset! @c 0 1 0 -1)
|
(#offset! @c 0 1 0 -1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(#eq? @_cdef_identifier "cdef")
|
(#eq? @_cdef_identifier "cdef")
|
||||||
(#match? @c "^\\[\\[")
|
(#lua-match? @c "^%[%[")
|
||||||
(#offset! @c 0 2 0 -2)
|
(#offset! @c 0 2 0 -2)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
;; Keywords
|
;; Keywords
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue