Debian Codegraph @

Xtree-house/test-grammars/rust/injections.scm

raw symbols SCIP
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")
6 (#set! injection.combined))
7
8 ((macro_invocation
9 macro:
10 [
11 (scoped_identifier
12 name: (_) @_macro_name)
13 (identifier) @_macro_name
14 ]
15 (token_tree) @injection.content)
16 (#eq? @_macro_name "html")
17 (#set! injection.language "html")
18 (#set! injection.include-children))
19
20 ((macro_invocation
21 macro:
22 [
23 (scoped_identifier
24 name: (_) @_macro_name)
25 (identifier) @_macro_name
26 ]
27 (token_tree) @injection.content)
28 (#eq? @_macro_name "slint")
29 (#set! injection.language "slint")
30 (#set! injection.include-children))
31
32 ((macro_invocation
33 (token_tree) @injection.content)
34 (#set! injection.language "rust")
35 (#set! injection.include-children))
36
37 ((macro_rule
38 (token_tree) @injection.content)
39 (#set! injection.language "rust")
40 (#set! injection.include-children))
41
42 (call_expression
43 function: (scoped_identifier
44 path: (identifier) @_regex (#eq? @_regex "Regex")
45 name: (identifier) @_new (#eq? @_new "new"))
46 arguments: (arguments (raw_string_literal) @injection.content)
47 (#set! injection.language "regex"))
48
49 (call_expression
50 function: (scoped_identifier
51 path: (scoped_identifier (identifier) @_regex (#eq? @_regex "Regex") .)
52 name: (identifier) @_new (#eq? @_new "new"))
53 arguments: (arguments (raw_string_literal) @injection.content)
54 (#set! injection.language "regex"))
55
56 ; Highlight SQL in `sqlx::query!()`, `sqlx::query_scalar!()`, and `sqlx::query_scalar_unchecked!()`
57 (macro_invocation
58 macro: (scoped_identifier
59 path: (identifier) @_sqlx (#eq? @_sqlx "sqlx")
60 name: (identifier) @_query (#match? @_query "^query(_scalar|_scalar_unchecked)?$"))
61 (token_tree
62 ; Only the first argument is SQL
63 .
64 [(string_literal) (raw_string_literal)] @injection.content
65 )
66 (#set! injection.language "sql"))
67
68 ; Highlight SQL in `sqlx::query_as!()` and `sqlx::query_as_unchecked!()`
69 (macro_invocation
70 macro: (scoped_identifier
71 path: (identifier) @_sqlx (#eq? @_sqlx "sqlx")
72 name: (identifier) @_query_as (#match? @_query_as "^query_as(_unchecked)?$"))
73 (token_tree
74 ; Only the second argument is SQL
75 .
76 ; Allow anything as the first argument in case the user has lower case type
77 ; names for some reason
78 (_)
79 [(string_literal) (raw_string_literal)] @injection.content
80 )
81 (#set! injection.language "sql"))