-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathrust.scm
87 lines (72 loc) · 1.25 KB
/
rust.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
;; https://github.com/tree-sitter/tree-sitter-rust/blob/master/src/grammar.json
[
(if_expression)
(if_let_expression)
] @ifStatement
;;!! "hello"
(
(string_literal) @string @textFragment
(#child-range! @textFragment 0 -1 true true)
)
;;!! r#"foobar"#
(
(raw_string_literal) @string @textFragment
(#shrink-to-match! @textFragment "r#+\"(?<keep>.*)\"#+")
)
[
(line_comment)
(block_comment)
] @comment @textFragment
[
(struct_item
name: (_) @className
)
(enum_item
name: (_) @className
)
] @class @className.domain
(struct_expression) @class
(trait_item
name: (_) @className
) @_.domain
(function_item
name: (_) @functionName
) @namedFunction @functionName.domain
[
(call_expression)
(macro_invocation)
(struct_expression)
] @functionCall
(call_expression
function: (_) @functionCallee
) @_.domain
(closure_expression) @anonymousFunction
[
(array_expression)
(tuple_expression)
] @list
(match_expression
value: (_) @private.switchStatementSubject
) @_.domain
operator: [
"<"
"<<"
"<<="
"<="
">"
">="
">>"
">>="
] @disqualifyDelimiter
(function_item
"->" @disqualifyDelimiter
)
(match_arm
"=>" @disqualifyDelimiter
)
(macro_rule
"=>" @disqualifyDelimiter
)
(lifetime
"'" @disqualifyDelimiter
)