mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 02:40:09 -04:00
feat!: drop modules, general refactor and cleanup
This commit is contained in:
parent
310f0925ec
commit
692b051b09
1247 changed files with 6096 additions and 9074 deletions
89
runtime/queries/rust/injections.scm
Normal file
89
runtime/queries/rust/injections.scm
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
(macro_invocation
|
||||
macro: [
|
||||
(scoped_identifier
|
||||
name: (_) @_macro_name)
|
||||
(identifier) @_macro_name
|
||||
]
|
||||
(token_tree) @injection.content
|
||||
(#not-any-of? @_macro_name "slint" "html" "json")
|
||||
(#set! injection.language "rust")
|
||||
(#set! injection.include-children))
|
||||
|
||||
(macro_invocation
|
||||
macro: [
|
||||
(scoped_identifier
|
||||
name: (_) @injection.language)
|
||||
(identifier) @injection.language
|
||||
]
|
||||
(token_tree) @injection.content
|
||||
(#any-of? @injection.language "slint" "html" "json")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children))
|
||||
|
||||
(macro_definition
|
||||
(macro_rule
|
||||
left: (token_tree_pattern) @injection.content
|
||||
(#set! injection.language "rust")))
|
||||
|
||||
(macro_definition
|
||||
(macro_rule
|
||||
right: (token_tree) @injection.content
|
||||
(#set! injection.language "rust")))
|
||||
|
||||
([
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
path: (identifier) @_regex
|
||||
(#any-of? @_regex "Regex" "RegexBuilder")
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments: (arguments
|
||||
(raw_string_literal
|
||||
(string_content) @injection.content))
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
path: (scoped_identifier
|
||||
(identifier) @_regex
|
||||
(#any-of? @_regex "Regex" "RegexBuilder") .)
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments: (arguments
|
||||
(raw_string_literal
|
||||
(string_content) @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
|
||||
(string_content) @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
|
||||
(string_content) @injection.content)))
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((block_comment) @injection.content
|
||||
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
|
||||
(#set! injection.language "re2c"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue