mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
feat(rust): add more regex injection queries
This commit is contained in:
parent
ede5b461c9
commit
6f1f407d71
1 changed files with 30 additions and 2 deletions
|
|
@ -48,7 +48,7 @@
|
||||||
function:
|
function:
|
||||||
(scoped_identifier
|
(scoped_identifier
|
||||||
path: (identifier) @_regex
|
path: (identifier) @_regex
|
||||||
(#eq? @_regex "Regex")
|
(#any-of? @_regex "Regex" "ByteRegexBuilder")
|
||||||
name: (identifier) @_new
|
name: (identifier) @_new
|
||||||
(#eq? @_new "new"))
|
(#eq? @_new "new"))
|
||||||
arguments:
|
arguments:
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
path:
|
path:
|
||||||
(scoped_identifier
|
(scoped_identifier
|
||||||
(identifier) @_regex
|
(identifier) @_regex
|
||||||
(#eq? @_regex "Regex") .)
|
(#any-of? @_regex "Regex" "ByteRegexBuilder") .)
|
||||||
name: (identifier) @_new
|
name: (identifier) @_new
|
||||||
(#eq? @_new "new"))
|
(#eq? @_new "new"))
|
||||||
arguments:
|
arguments:
|
||||||
|
|
@ -70,6 +70,34 @@
|
||||||
(raw_string_literal) @injection.content)
|
(raw_string_literal) @injection.content)
|
||||||
(#set! injection.language "regex"))
|
(#set! injection.language "regex"))
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
function:
|
||||||
|
(scoped_identifier
|
||||||
|
path: (identifier) @_regex
|
||||||
|
(#any-of? @_regex "RegexSet" "RegexSetBuilder")
|
||||||
|
name: (identifier) @_new
|
||||||
|
(#eq? @_new "new"))
|
||||||
|
arguments:
|
||||||
|
(arguments
|
||||||
|
(array_expression
|
||||||
|
(raw_string_literal) @injection.content))
|
||||||
|
(#set! injection.language "regex"))
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
function:
|
||||||
|
(scoped_identifier
|
||||||
|
path:
|
||||||
|
(scoped_identifier
|
||||||
|
(identifier) @_regex
|
||||||
|
(#any-of? @_regex "RegexSet" "RegexSetBuilder") .)
|
||||||
|
name: (identifier) @_new
|
||||||
|
(#eq? @_new "new"))
|
||||||
|
arguments:
|
||||||
|
(arguments
|
||||||
|
(array_expression
|
||||||
|
(raw_string_literal) @injection.content))
|
||||||
|
(#set! injection.language "regex"))
|
||||||
|
|
||||||
((block_comment) @injection.content
|
((block_comment) @injection.content
|
||||||
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
|
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
|
||||||
(#set! injection.language "re2c"))
|
(#set! injection.language "re2c"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue