aboutsummaryrefslogtreecommitdiffstats
path: root/queries/rust
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2024-02-25 02:14:48 -0500
committerAmaan Qureshi <amaanq12@gmail.com>2024-02-25 09:05:08 -0500
commit6f1f407d712d1c451451db74ff3a6eb72190548d (patch)
treed6880b2ffacd9c1d0e042299d9b98cca1af6dbe5 /queries/rust
parentUpdate parsers: gpg, properties, pymanifest, requirements, rust, ssh_config, ... (diff)
downloadnvim-treesitter-6f1f407d712d1c451451db74ff3a6eb72190548d.tar
nvim-treesitter-6f1f407d712d1c451451db74ff3a6eb72190548d.tar.gz
nvim-treesitter-6f1f407d712d1c451451db74ff3a6eb72190548d.tar.bz2
nvim-treesitter-6f1f407d712d1c451451db74ff3a6eb72190548d.tar.lz
nvim-treesitter-6f1f407d712d1c451451db74ff3a6eb72190548d.tar.xz
nvim-treesitter-6f1f407d712d1c451451db74ff3a6eb72190548d.tar.zst
nvim-treesitter-6f1f407d712d1c451451db74ff3a6eb72190548d.zip
feat(rust): add more regex injection queries
Diffstat (limited to 'queries/rust')
-rw-r--r--queries/rust/injections.scm32
1 files changed, 30 insertions, 2 deletions
diff --git a/queries/rust/injections.scm b/queries/rust/injections.scm
index d561d4ec9..629f707c7 100644
--- a/queries/rust/injections.scm
+++ b/queries/rust/injections.scm
@@ -48,7 +48,7 @@
function:
(scoped_identifier
path: (identifier) @_regex
- (#eq? @_regex "Regex")
+ (#any-of? @_regex "Regex" "ByteRegexBuilder")
name: (identifier) @_new
(#eq? @_new "new"))
arguments:
@@ -62,7 +62,7 @@
path:
(scoped_identifier
(identifier) @_regex
- (#eq? @_regex "Regex") .)
+ (#any-of? @_regex "Regex" "ByteRegexBuilder") .)
name: (identifier) @_new
(#eq? @_new "new"))
arguments:
@@ -70,6 +70,34 @@
(raw_string_literal) @injection.content)
(#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
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
(#set! injection.language "re2c"))