| 1 |
([(line_comment !doc) (block_comment !doc)] @injection.content |
| 2 |
(#set! injection.language "comment")) |
| 3 |
|
| 4 |
((doc_comment) @injection.content |
| 5 |
(#set! injection.language "markdown-rustdoc") |
| 6 |
(#set! injection.combined)) |
| 7 |
|
| 8 |
((macro_invocation |
| 9 |
(token_tree) @injection.content) |
| 10 |
(#set! injection.language "rust") |
| 11 |
(#set! injection.include-children)) |
| 12 |
|
| 13 |
((macro_rule |
| 14 |
(token_tree) @injection.content) |
| 15 |
(#set! injection.language "rust") |
| 16 |
(#set! injection.include-children)) |
| 17 |
|
| 18 |
((macro_invocation |
| 19 |
macro: |
| 20 |
[ |
| 21 |
(scoped_identifier |
| 22 |
name: (_) @_macro_name) |
| 23 |
(identifier) @_macro_name |
| 24 |
] |
| 25 |
(token_tree) @injection.content) |
| 26 |
(#eq? @_macro_name "html") |
| 27 |
(#set! injection.language "html") |
| 28 |
(#set! injection.include-children)) |
| 29 |
|
| 30 |
((macro_invocation |
| 31 |
macro: |
| 32 |
[ |
| 33 |
(scoped_identifier |
| 34 |
name: (_) @_macro_name) |
| 35 |
(identifier) @_macro_name |
| 36 |
] |
| 37 |
(token_tree) @injection.content) |
| 38 |
(#eq? @_macro_name "slint") |
| 39 |
(#set! injection.language "slint") |
| 40 |
(#set! injection.include-children)) |
| 41 |
|
| 42 |
((macro_invocation |
| 43 |
macro: |
| 44 |
[ |
| 45 |
(scoped_identifier name: (_) @_macro_name) |
| 46 |
(identifier) @_macro_name |
| 47 |
] |
| 48 |
(token_tree |
| 49 |
(token_tree . "{" "}" .) @injection.content)) |
| 50 |
(#eq? @_macro_name "json") |
| 51 |
(#set! injection.language "json") |
| 52 |
(#set! injection.include-children)) |
| 53 |
|
| 54 |
(call_expression |
| 55 |
function: (scoped_identifier |
| 56 |
path: (identifier) @_regex (#any-of? @_regex "Regex" "RegexBuilder") |
| 57 |
name: (identifier) @_new (#eq? @_new "new")) |
| 58 |
arguments: |
| 59 |
(arguments |
| 60 |
[ |
| 61 |
(string_literal (string_content) @injection.content) |
| 62 |
(raw_string_literal (string_content) @injection.content) |
| 63 |
]) |
| 64 |
(#set! injection.language "regex")) |
| 65 |
|
| 66 |
(call_expression |
| 67 |
function: (scoped_identifier |
| 68 |
path: (scoped_identifier (identifier) @_regex (#any-of? @_regex "Regex" "RegexBuilder") .) |
| 69 |
name: (identifier) @_new (#eq? @_new "new")) |
| 70 |
arguments: |
| 71 |
(arguments |
| 72 |
[ |
| 73 |
(string_literal (string_content) @injection.content) |
| 74 |
(raw_string_literal (string_content) @injection.content) |
| 75 |
]) |
| 76 |
(#set! injection.language "regex")) |
| 77 |
|
| 78 |
|
| 79 |
(macro_invocation |
| 80 |
macro: (scoped_identifier |
| 81 |
path: (identifier) @_sqlx (#eq? @_sqlx "sqlx") |
| 82 |
name: (identifier) @_query (#match? @_query "^query(_scalar|_scalar_unchecked)?$")) |
| 83 |
(token_tree |
| 84 |
|
| 85 |
. |
| 86 |
[ |
| 87 |
(string_literal (string_content) @injection.content) |
| 88 |
(raw_string_literal (string_content) @injection.content) |
| 89 |
] |
| 90 |
) |
| 91 |
(#set! injection.language "sql")) |
| 92 |
|
| 93 |
|
| 94 |
(macro_invocation |
| 95 |
macro: (scoped_identifier |
| 96 |
path: (identifier) @_sqlx (#eq? @_sqlx "sqlx") |
| 97 |
name: (identifier) @_query_as (#match? @_query_as "^query_as(_unchecked)?$")) |
| 98 |
(token_tree |
| 99 |
|
| 100 |
. |
| 101 |
|
| 102 |
|
| 103 |
(_) |
| 104 |
[ |
| 105 |
(string_literal (string_content) @injection.content) |
| 106 |
(raw_string_literal (string_content) @injection.content) |
| 107 |
] |
| 108 |
) |
| 109 |
(#set! injection.language "sql")) |
| 110 |
|
| 111 |
|
| 112 |
(call_expression |
| 113 |
function: (scoped_identifier |
| 114 |
path: (identifier) @_sqlx |
| 115 |
(#eq? @_sqlx "sqlx") |
| 116 |
name: (identifier) @_query_function) |
| 117 |
(#match? @_query_function "^query.*|raw_sql$") |
| 118 |
arguments: (arguments |
| 119 |
. |
| 120 |
[ |
| 121 |
(string_literal |
| 122 |
(string_content) @injection.content) |
| 123 |
(raw_string_literal |
| 124 |
(string_content) @injection.content) |
| 125 |
]) |
| 126 |
(#set! injection.language "sql")) |
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
( |
| 134 |
(macro_invocation |
| 135 |
macro: |
| 136 |
[ |
| 137 |
(scoped_identifier |
| 138 |
name: (_) @_macro_name) |
| 139 |
(identifier) @_macro_name |
| 140 |
] |
| 141 |
(token_tree) @injection.content |
| 142 |
) |
| 143 |
(#any-of? @_macro_name |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
"print" "println" "eprint" "eprintln" |
| 148 |
"format" "format_args" "todo" "panic" |
| 149 |
"unreachable" "unimplemented" "compile_error" |
| 150 |
|
| 151 |
"crit" "trace" "debug" "info" "warn" "error" |
| 152 |
|
| 153 |
"anyhow" "bail" |
| 154 |
|
| 155 |
"format_ident" |
| 156 |
|
| 157 |
"formatdoc" "printdoc" "eprintdoc" "writedoc" |
| 158 |
|
| 159 |
"text" |
| 160 |
|
| 161 |
"span" |
| 162 |
|
| 163 |
"eyre" |
| 164 |
|
| 165 |
"miette" |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
"write" "writeln" "assert" "debug_assert" |
| 171 |
|
| 172 |
"expect" "unwrap" |
| 173 |
|
| 174 |
"span" |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
"assert_eq" "debug_assert_eq" "assert_ne" "debug_assert_ne" |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
"rsx" |
| 184 |
) |
| 185 |
(#set! injection.language "rust-format-args-macro") |
| 186 |
(#set! injection.include-children) |
| 187 |
) |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
(call_expression |
| 192 |
function: [ |
| 193 |
(scoped_identifier |
| 194 |
path: (identifier) @_sqlx |
| 195 |
(#eq? @_sqlx "sqlx") |
| 196 |
name: (identifier) @_AssertSqlSafe) |
| 197 |
(identifier) @_AssertSqlSafe |
| 198 |
] |
| 199 |
(#eq? @_AssertSqlSafe "AssertSqlSafe") |
| 200 |
arguments: (arguments |
| 201 |
[ |
| 202 |
(string_literal |
| 203 |
(string_content) @injection.content) |
| 204 |
(raw_string_literal |
| 205 |
(string_content) @injection.content) |
| 206 |
(macro_invocation |
| 207 |
macro: (identifier) @_format |
| 208 |
(#eq? @_format "format") |
| 209 |
(token_tree |
| 210 |
[ |
| 211 |
(string_literal |
| 212 |
(string_content) @injection.content) |
| 213 |
(raw_string_literal |
| 214 |
(string_content) @injection.content) |
| 215 |
])) |
| 216 |
]) |
| 217 |
(#set! injection.language "sql")) |