nvim-treesitter/queries/rust/injections.scm

92 lines
2.4 KiB
Scheme
Raw Normal View History

2021-01-06 14:25:43 -05:00
(macro_invocation
macro: [
(scoped_identifier
name: (_) @_macro_name)
(identifier) @_macro_name
]
2024-01-06 15:05:50 +09:00
(token_tree) @injection.content
(#not-eq? @_macro_name "slint")
(#set! injection.language "rust")
(#set! injection.include-children))
2021-01-06 14:25:43 -05:00
(macro_invocation
macro: [
(scoped_identifier
name: (_) @_macro_name)
(identifier) @_macro_name
]
(token_tree) @injection.content
(#eq? @_macro_name "slint")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "slint")
(#set! injection.include-children))
2021-01-06 14:25:43 -05:00
(macro_definition
(macro_rule
2024-01-06 15:05:50 +09:00
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
2024-01-06 15:05:50 +09:00
(#set! injection.language "comment"))
2021-06-20 21:20:50 +03:00
((macro_invocation
2024-01-21 22:05:44 +09:00
macro: (identifier) @injection.language
2024-01-06 15:05:50 +09:00
(token_tree) @injection.content)
(#any-of? @injection.language "html" "json"))
2021-06-20 21:20:50 +03:00
(call_expression
function: (scoped_identifier
path: (identifier) @_regex
(#any-of? @_regex "Regex" "ByteRegexBuilder")
name: (identifier) @_new
(#eq? @_new "new"))
arguments: (arguments
(raw_string_literal) @injection.content)
2024-01-06 15:05:50 +09:00
(#set! injection.language "regex"))
(call_expression
function: (scoped_identifier
path: (scoped_identifier
(identifier) @_regex
(#any-of? @_regex "Regex" "ByteRegexBuilder") .)
name: (identifier) @_new
(#eq? @_new "new"))
arguments: (arguments
(raw_string_literal) @injection.content)
2024-01-06 15:05:50 +09:00
(#set! injection.language "regex"))
2023-08-22 02:10:29 -04:00
(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"))
2023-08-22 02:10:29 -04:00
((block_comment) @injection.content
2023-08-25 05:02:58 -04:00
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
2023-08-22 02:10:29 -04:00
(#set! injection.language "re2c"))