1((line_comment) @injection.content
2 (#set! injection.language "comment"))
3
4(macro_invocation
5 macro: [
6 ((identifier) @_macro_name)
7 (scoped_identifier (identifier) @_macro_name .)
8 ]
9 (token_tree) @injection.content
10 (#set! injection.language "rust"))
11
12; we need a better way for the leptos extension to declare that
13; it wants to inject inside of rust, instead of modifying the rust
14; injections to support leptos injections
15(macro_invocation
16 macro: [
17 ((identifier) @_macro_name)
18 (scoped_identifier (identifier) @_macro_name .)
19 ]
20 (#any-of? @_macro_name "view" "html")
21 (token_tree) @injection.content
22 (#set! injection.language "rstml")
23 )
24
25(macro_invocation
26 macro: [
27 ((identifier) @_macro_name)
28 (scoped_identifier (identifier) @_macro_name .)
29 ]
30 (#any-of? @_macro_name "sql")
31 (_) @injection.content
32 (#set! injection.language "sql")
33 )
34
35; lazy_regex
36(macro_invocation
37 macro: [
38 ((identifier) @_macro_name)
39 (scoped_identifier (identifier) @_macro_name .)
40 ]
41 (token_tree [
42 (string_literal (string_content) @injection.content)
43 (raw_string_literal (string_content) @injection.content)
44 ])
45 (#set! injection.language "regex")
46 (#any-of? @_macro_name "regex" "bytes_regex")
47)
48
49(call_expression
50 function: (scoped_identifier) @_fn_path
51 arguments: (arguments
52 [
53 (string_literal (string_content) @injection.content)
54 (raw_string_literal (string_content) @injection.content)
55 ]
56 )
57
58 (#match? @_fn_path ".*Regex(Builder)?::new")
59 (#set! injection.language "regex")
60)