ts-wasms 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README +2 -0
- package/out/bash/highlights.scm +56 -0
- package/out/bash/tree-sitter-bash.wasm +0 -0
- package/out/c/highlights.scm +81 -0
- package/out/c/tags.scm +9 -0
- package/out/c/tree-sitter-c.wasm +0 -0
- package/out/c-sharp/highlights.scm +213 -0
- package/out/c-sharp/tags.scm +23 -0
- package/out/c-sharp/tree-sitter-c_sharp.wasm +0 -0
- package/out/cpp/highlights.scm +70 -0
- package/out/cpp/injections.scm +3 -0
- package/out/cpp/tags.scm +15 -0
- package/out/cpp/tree-sitter-cpp.wasm +0 -0
- package/out/css/highlights.scm +76 -0
- package/out/css/tree-sitter-css.wasm +0 -0
- package/out/dart/folds.scm +8 -0
- package/out/dart/highlights.scm +224 -0
- package/out/dart/tree-sitter-dart.wasm +0 -0
- package/out/elisp/highlights.scm +72 -0
- package/out/elisp/tags.scm +5 -0
- package/out/elisp/tree-sitter-elisp.wasm +0 -0
- package/out/elixir/highlights.scm +223 -0
- package/out/elixir/injections.scm +55 -0
- package/out/elixir/tags.scm +54 -0
- package/out/elixir/tree-sitter-elixir.wasm +0 -0
- package/out/embedded-template/highlights.scm +12 -0
- package/out/embedded-template/injections-ejs.scm +7 -0
- package/out/embedded-template/injections-erb.scm +7 -0
- package/out/embedded-template/injections-etlua.scm +7 -0
- package/out/embedded-template/tree-sitter-embedded_template.wasm +0 -0
- package/out/go/highlights.scm +123 -0
- package/out/go/tags.scm +42 -0
- package/out/go/tree-sitter-go.wasm +0 -0
- package/out/haskell/highlights.scm +443 -0
- package/out/haskell/injections.scm +76 -0
- package/out/haskell/locals.scm +4 -0
- package/out/haskell/tree-sitter-haskell.wasm +0 -0
- package/out/html/highlights.scm +13 -0
- package/out/html/injections.scm +7 -0
- package/out/html/tree-sitter-html.wasm +0 -0
- package/out/java/highlights.scm +149 -0
- package/out/java/tags.scm +20 -0
- package/out/java/tree-sitter-java.wasm +0 -0
- package/out/javascript/highlights-jsx.scm +8 -0
- package/out/javascript/highlights-params.scm +12 -0
- package/out/javascript/highlights.scm +204 -0
- package/out/javascript/injections.scm +31 -0
- package/out/javascript/locals.scm +23 -0
- package/out/javascript/tags.scm +99 -0
- package/out/javascript/tree-sitter-javascript.wasm +0 -0
- package/out/json/highlights.scm +16 -0
- package/out/json/tree-sitter-json.wasm +0 -0
- package/out/kotlin/highlights.scm +380 -0
- package/out/kotlin/tree-sitter-kotlin.wasm +0 -0
- package/out/objc/folds.scm +20 -0
- package/out/objc/highlights.scm +216 -0
- package/out/objc/indents.scm +1 -0
- package/out/objc/injections.scm +10 -0
- package/out/objc/locals.scm +1 -0
- package/out/objc/tree-sitter-objc.wasm +0 -0
- package/out/php/tree-sitter-php.wasm +0 -0
- package/out/php_only/tree-sitter-php_only.wasm +0 -0
- package/out/python/highlights.scm +137 -0
- package/out/python/tags.scm +14 -0
- package/out/python/tree-sitter-python.wasm +0 -0
- package/out/regex/highlights.scm +63 -0
- package/out/regex/tree-sitter-regex.wasm +0 -0
- package/out/ruby/highlights.scm +154 -0
- package/out/ruby/locals.scm +27 -0
- package/out/ruby/tags.scm +64 -0
- package/out/ruby/tree-sitter-ruby.wasm +0 -0
- package/out/rust/highlights.scm +161 -0
- package/out/rust/injections.scm +9 -0
- package/out/rust/tags.scm +60 -0
- package/out/rust/tree-sitter-rust.wasm +0 -0
- package/out/scala/highlights.scm +260 -0
- package/out/scala/indents.scm +30 -0
- package/out/scala/locals.scm +30 -0
- package/out/scala/tags.scm +66 -0
- package/out/scala/tree-sitter-scala.wasm +0 -0
- package/out/swift/folds.scm +35 -0
- package/out/swift/highlights.scm +336 -0
- package/out/swift/indents.scm +123 -0
- package/out/swift/injections.scm +10 -0
- package/out/swift/locals.scm +23 -0
- package/out/swift/outline.scm +66 -0
- package/out/swift/tags.scm +51 -0
- package/out/swift/textobjects.scm +19 -0
- package/out/swift/tree-sitter-swift.wasm +0 -0
- package/out/tsx/tree-sitter-tsx.wasm +0 -0
- package/out/typescript/tree-sitter-typescript.wasm +0 -0
- package/out/vue/tree-sitter-vue.wasm +0 -0
- package/package.json +64 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
; Identifier naming conventions
|
|
2
|
+
|
|
3
|
+
(identifier) @variable
|
|
4
|
+
|
|
5
|
+
((identifier) @constructor
|
|
6
|
+
(#match? @constructor "^[A-Z]"))
|
|
7
|
+
|
|
8
|
+
((identifier) @constant
|
|
9
|
+
(#match? @constant "^[A-Z][A-Z_]*$"))
|
|
10
|
+
|
|
11
|
+
; Function calls
|
|
12
|
+
|
|
13
|
+
(decorator) @function
|
|
14
|
+
(decorator
|
|
15
|
+
(identifier) @function)
|
|
16
|
+
|
|
17
|
+
(call
|
|
18
|
+
function: (attribute attribute: (identifier) @function.method))
|
|
19
|
+
(call
|
|
20
|
+
function: (identifier) @function)
|
|
21
|
+
|
|
22
|
+
; Builtin functions
|
|
23
|
+
|
|
24
|
+
((call
|
|
25
|
+
function: (identifier) @function.builtin)
|
|
26
|
+
(#match?
|
|
27
|
+
@function.builtin
|
|
28
|
+
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
|
|
29
|
+
|
|
30
|
+
; Function definitions
|
|
31
|
+
|
|
32
|
+
(function_definition
|
|
33
|
+
name: (identifier) @function)
|
|
34
|
+
|
|
35
|
+
(attribute attribute: (identifier) @property)
|
|
36
|
+
(type (identifier) @type)
|
|
37
|
+
|
|
38
|
+
; Literals
|
|
39
|
+
|
|
40
|
+
[
|
|
41
|
+
(none)
|
|
42
|
+
(true)
|
|
43
|
+
(false)
|
|
44
|
+
] @constant.builtin
|
|
45
|
+
|
|
46
|
+
[
|
|
47
|
+
(integer)
|
|
48
|
+
(float)
|
|
49
|
+
] @number
|
|
50
|
+
|
|
51
|
+
(comment) @comment
|
|
52
|
+
(string) @string
|
|
53
|
+
(escape_sequence) @escape
|
|
54
|
+
|
|
55
|
+
(interpolation
|
|
56
|
+
"{" @punctuation.special
|
|
57
|
+
"}" @punctuation.special) @embedded
|
|
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
|
+
"=="
|
|
88
|
+
">"
|
|
89
|
+
">="
|
|
90
|
+
">>"
|
|
91
|
+
">>="
|
|
92
|
+
"|"
|
|
93
|
+
"|="
|
|
94
|
+
"~"
|
|
95
|
+
"@="
|
|
96
|
+
"and"
|
|
97
|
+
"in"
|
|
98
|
+
"is"
|
|
99
|
+
"not"
|
|
100
|
+
"or"
|
|
101
|
+
"is not"
|
|
102
|
+
"not in"
|
|
103
|
+
] @operator
|
|
104
|
+
|
|
105
|
+
[
|
|
106
|
+
"as"
|
|
107
|
+
"assert"
|
|
108
|
+
"async"
|
|
109
|
+
"await"
|
|
110
|
+
"break"
|
|
111
|
+
"class"
|
|
112
|
+
"continue"
|
|
113
|
+
"def"
|
|
114
|
+
"del"
|
|
115
|
+
"elif"
|
|
116
|
+
"else"
|
|
117
|
+
"except"
|
|
118
|
+
"exec"
|
|
119
|
+
"finally"
|
|
120
|
+
"for"
|
|
121
|
+
"from"
|
|
122
|
+
"global"
|
|
123
|
+
"if"
|
|
124
|
+
"import"
|
|
125
|
+
"lambda"
|
|
126
|
+
"nonlocal"
|
|
127
|
+
"pass"
|
|
128
|
+
"print"
|
|
129
|
+
"raise"
|
|
130
|
+
"return"
|
|
131
|
+
"try"
|
|
132
|
+
"while"
|
|
133
|
+
"with"
|
|
134
|
+
"yield"
|
|
135
|
+
"match"
|
|
136
|
+
"case"
|
|
137
|
+
] @keyword
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
(module (expression_statement (assignment left: (identifier) @name) @definition.constant))
|
|
2
|
+
|
|
3
|
+
(class_definition
|
|
4
|
+
name: (identifier) @name) @definition.class
|
|
5
|
+
|
|
6
|
+
(function_definition
|
|
7
|
+
name: (identifier) @name) @definition.function
|
|
8
|
+
|
|
9
|
+
(call
|
|
10
|
+
function: [
|
|
11
|
+
(identifier) @name
|
|
12
|
+
(attribute
|
|
13
|
+
attribute: (identifier) @name)
|
|
14
|
+
]) @reference.call
|
|
Binary file
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[
|
|
2
|
+
"("
|
|
3
|
+
")"
|
|
4
|
+
"(?"
|
|
5
|
+
"(?:"
|
|
6
|
+
"(?<"
|
|
7
|
+
"(?P<"
|
|
8
|
+
"(?P="
|
|
9
|
+
">"
|
|
10
|
+
"["
|
|
11
|
+
"]"
|
|
12
|
+
"{"
|
|
13
|
+
"}"
|
|
14
|
+
"[:"
|
|
15
|
+
":]"
|
|
16
|
+
] @punctuation.bracket
|
|
17
|
+
|
|
18
|
+
(group_name) @property
|
|
19
|
+
|
|
20
|
+
[
|
|
21
|
+
(identity_escape)
|
|
22
|
+
(control_letter_escape)
|
|
23
|
+
(character_class_escape)
|
|
24
|
+
(control_escape)
|
|
25
|
+
(start_assertion)
|
|
26
|
+
(end_assertion)
|
|
27
|
+
(boundary_assertion)
|
|
28
|
+
(non_boundary_assertion)
|
|
29
|
+
] @escape
|
|
30
|
+
|
|
31
|
+
[
|
|
32
|
+
"*"
|
|
33
|
+
"+"
|
|
34
|
+
"?"
|
|
35
|
+
"|"
|
|
36
|
+
"="
|
|
37
|
+
"!"
|
|
38
|
+
] @operator
|
|
39
|
+
|
|
40
|
+
(count_quantifier
|
|
41
|
+
[
|
|
42
|
+
(decimal_digits) @number
|
|
43
|
+
"," @punctuation.delimiter
|
|
44
|
+
])
|
|
45
|
+
|
|
46
|
+
(inline_flags_group
|
|
47
|
+
"-"? @operator
|
|
48
|
+
":"? @punctuation.delimiter)
|
|
49
|
+
|
|
50
|
+
(flags) @character.special
|
|
51
|
+
|
|
52
|
+
(character_class
|
|
53
|
+
[
|
|
54
|
+
"^" @operator
|
|
55
|
+
(class_range "-" @operator)
|
|
56
|
+
])
|
|
57
|
+
|
|
58
|
+
[
|
|
59
|
+
(class_character)
|
|
60
|
+
(posix_class_name)
|
|
61
|
+
] @constant.character
|
|
62
|
+
|
|
63
|
+
(pattern_character) @string
|
|
Binary file
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
(identifier) @variable
|
|
2
|
+
|
|
3
|
+
((identifier) @function.method
|
|
4
|
+
(#is-not? local))
|
|
5
|
+
|
|
6
|
+
[
|
|
7
|
+
"alias"
|
|
8
|
+
"and"
|
|
9
|
+
"begin"
|
|
10
|
+
"break"
|
|
11
|
+
"case"
|
|
12
|
+
"class"
|
|
13
|
+
"def"
|
|
14
|
+
"do"
|
|
15
|
+
"else"
|
|
16
|
+
"elsif"
|
|
17
|
+
"end"
|
|
18
|
+
"ensure"
|
|
19
|
+
"for"
|
|
20
|
+
"if"
|
|
21
|
+
"in"
|
|
22
|
+
"module"
|
|
23
|
+
"next"
|
|
24
|
+
"or"
|
|
25
|
+
"rescue"
|
|
26
|
+
"retry"
|
|
27
|
+
"return"
|
|
28
|
+
"then"
|
|
29
|
+
"unless"
|
|
30
|
+
"until"
|
|
31
|
+
"when"
|
|
32
|
+
"while"
|
|
33
|
+
"yield"
|
|
34
|
+
] @keyword
|
|
35
|
+
|
|
36
|
+
((identifier) @keyword
|
|
37
|
+
(#match? @keyword "^(private|protected|public)$"))
|
|
38
|
+
|
|
39
|
+
(constant) @constructor
|
|
40
|
+
|
|
41
|
+
; Function calls
|
|
42
|
+
|
|
43
|
+
"defined?" @function.method.builtin
|
|
44
|
+
|
|
45
|
+
(call
|
|
46
|
+
method: [(identifier) (constant)] @function.method)
|
|
47
|
+
|
|
48
|
+
((identifier) @function.method.builtin
|
|
49
|
+
(#eq? @function.method.builtin "require"))
|
|
50
|
+
|
|
51
|
+
; Function definitions
|
|
52
|
+
|
|
53
|
+
(alias (identifier) @function.method)
|
|
54
|
+
(setter (identifier) @function.method)
|
|
55
|
+
(method name: [(identifier) (constant)] @function.method)
|
|
56
|
+
(singleton_method name: [(identifier) (constant)] @function.method)
|
|
57
|
+
|
|
58
|
+
; Identifiers
|
|
59
|
+
|
|
60
|
+
[
|
|
61
|
+
(class_variable)
|
|
62
|
+
(instance_variable)
|
|
63
|
+
] @property
|
|
64
|
+
|
|
65
|
+
((identifier) @constant.builtin
|
|
66
|
+
(#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
|
|
67
|
+
|
|
68
|
+
(file) @constant.builtin
|
|
69
|
+
(line) @constant.builtin
|
|
70
|
+
(encoding) @constant.builtin
|
|
71
|
+
|
|
72
|
+
(hash_splat_nil
|
|
73
|
+
"**" @operator) @constant.builtin
|
|
74
|
+
|
|
75
|
+
((constant) @constant
|
|
76
|
+
(#match? @constant "^[A-Z\\d_]+$"))
|
|
77
|
+
|
|
78
|
+
[
|
|
79
|
+
(self)
|
|
80
|
+
(super)
|
|
81
|
+
] @variable.builtin
|
|
82
|
+
|
|
83
|
+
(block_parameter (identifier) @variable.parameter)
|
|
84
|
+
(block_parameters (identifier) @variable.parameter)
|
|
85
|
+
(destructured_parameter (identifier) @variable.parameter)
|
|
86
|
+
(hash_splat_parameter (identifier) @variable.parameter)
|
|
87
|
+
(lambda_parameters (identifier) @variable.parameter)
|
|
88
|
+
(method_parameters (identifier) @variable.parameter)
|
|
89
|
+
(splat_parameter (identifier) @variable.parameter)
|
|
90
|
+
|
|
91
|
+
(keyword_parameter name: (identifier) @variable.parameter)
|
|
92
|
+
(optional_parameter name: (identifier) @variable.parameter)
|
|
93
|
+
|
|
94
|
+
; Literals
|
|
95
|
+
|
|
96
|
+
[
|
|
97
|
+
(string)
|
|
98
|
+
(bare_string)
|
|
99
|
+
(subshell)
|
|
100
|
+
(heredoc_body)
|
|
101
|
+
(heredoc_beginning)
|
|
102
|
+
] @string
|
|
103
|
+
|
|
104
|
+
[
|
|
105
|
+
(simple_symbol)
|
|
106
|
+
(delimited_symbol)
|
|
107
|
+
(hash_key_symbol)
|
|
108
|
+
(bare_symbol)
|
|
109
|
+
] @string.special.symbol
|
|
110
|
+
|
|
111
|
+
(regex) @string.special.regex
|
|
112
|
+
(escape_sequence) @escape
|
|
113
|
+
|
|
114
|
+
[
|
|
115
|
+
(integer)
|
|
116
|
+
(float)
|
|
117
|
+
] @number
|
|
118
|
+
|
|
119
|
+
[
|
|
120
|
+
(nil)
|
|
121
|
+
(true)
|
|
122
|
+
(false)
|
|
123
|
+
] @constant.builtin
|
|
124
|
+
|
|
125
|
+
(interpolation
|
|
126
|
+
"#{" @punctuation.special
|
|
127
|
+
"}" @punctuation.special) @embedded
|
|
128
|
+
|
|
129
|
+
(comment) @comment
|
|
130
|
+
|
|
131
|
+
; Operators
|
|
132
|
+
|
|
133
|
+
[
|
|
134
|
+
"="
|
|
135
|
+
"=>"
|
|
136
|
+
"->"
|
|
137
|
+
] @operator
|
|
138
|
+
|
|
139
|
+
[
|
|
140
|
+
","
|
|
141
|
+
";"
|
|
142
|
+
"."
|
|
143
|
+
] @punctuation.delimiter
|
|
144
|
+
|
|
145
|
+
[
|
|
146
|
+
"("
|
|
147
|
+
")"
|
|
148
|
+
"["
|
|
149
|
+
"]"
|
|
150
|
+
"{"
|
|
151
|
+
"}"
|
|
152
|
+
"%w("
|
|
153
|
+
"%i("
|
|
154
|
+
] @punctuation.bracket
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
((method) @local.scope
|
|
2
|
+
(#set! local.scope-inherits false))
|
|
3
|
+
|
|
4
|
+
[
|
|
5
|
+
(lambda)
|
|
6
|
+
(block)
|
|
7
|
+
(do_block)
|
|
8
|
+
] @local.scope
|
|
9
|
+
|
|
10
|
+
(block_parameter (identifier) @local.definition)
|
|
11
|
+
(block_parameters (identifier) @local.definition)
|
|
12
|
+
(destructured_parameter (identifier) @local.definition)
|
|
13
|
+
(hash_splat_parameter (identifier) @local.definition)
|
|
14
|
+
(lambda_parameters (identifier) @local.definition)
|
|
15
|
+
(method_parameters (identifier) @local.definition)
|
|
16
|
+
(splat_parameter (identifier) @local.definition)
|
|
17
|
+
|
|
18
|
+
(keyword_parameter name: (identifier) @local.definition)
|
|
19
|
+
(optional_parameter name: (identifier) @local.definition)
|
|
20
|
+
|
|
21
|
+
(identifier) @local.reference
|
|
22
|
+
|
|
23
|
+
(assignment left: (identifier) @local.definition)
|
|
24
|
+
(operator_assignment left: (identifier) @local.definition)
|
|
25
|
+
(left_assignment_list (identifier) @local.definition)
|
|
26
|
+
(rest_assignment (identifier) @local.definition)
|
|
27
|
+
(destructured_left_assignment (identifier) @local.definition)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
; Method definitions
|
|
2
|
+
|
|
3
|
+
(
|
|
4
|
+
(comment)* @doc
|
|
5
|
+
.
|
|
6
|
+
[
|
|
7
|
+
(method
|
|
8
|
+
name: (_) @name) @definition.method
|
|
9
|
+
(singleton_method
|
|
10
|
+
name: (_) @name) @definition.method
|
|
11
|
+
]
|
|
12
|
+
(#strip! @doc "^#\\s*")
|
|
13
|
+
(#select-adjacent! @doc @definition.method)
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
(alias
|
|
17
|
+
name: (_) @name) @definition.method
|
|
18
|
+
|
|
19
|
+
(setter
|
|
20
|
+
(identifier) @ignore)
|
|
21
|
+
|
|
22
|
+
; Class definitions
|
|
23
|
+
|
|
24
|
+
(
|
|
25
|
+
(comment)* @doc
|
|
26
|
+
.
|
|
27
|
+
[
|
|
28
|
+
(class
|
|
29
|
+
name: [
|
|
30
|
+
(constant) @name
|
|
31
|
+
(scope_resolution
|
|
32
|
+
name: (_) @name)
|
|
33
|
+
]) @definition.class
|
|
34
|
+
(singleton_class
|
|
35
|
+
value: [
|
|
36
|
+
(constant) @name
|
|
37
|
+
(scope_resolution
|
|
38
|
+
name: (_) @name)
|
|
39
|
+
]) @definition.class
|
|
40
|
+
]
|
|
41
|
+
(#strip! @doc "^#\\s*")
|
|
42
|
+
(#select-adjacent! @doc @definition.class)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
; Module definitions
|
|
46
|
+
|
|
47
|
+
(
|
|
48
|
+
(module
|
|
49
|
+
name: [
|
|
50
|
+
(constant) @name
|
|
51
|
+
(scope_resolution
|
|
52
|
+
name: (_) @name)
|
|
53
|
+
]) @definition.module
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
; Calls
|
|
57
|
+
|
|
58
|
+
(call method: (identifier) @name) @reference.call
|
|
59
|
+
|
|
60
|
+
(
|
|
61
|
+
[(identifier) (constant)] @name @reference.call
|
|
62
|
+
(#is-not? local)
|
|
63
|
+
(#not-match? @name "^(lambda|load|require|require_relative|__FILE__|__LINE__)$")
|
|
64
|
+
)
|
|
Binary file
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
; Identifiers
|
|
2
|
+
|
|
3
|
+
(type_identifier) @type
|
|
4
|
+
(primitive_type) @type.builtin
|
|
5
|
+
(field_identifier) @property
|
|
6
|
+
|
|
7
|
+
; Identifier conventions
|
|
8
|
+
|
|
9
|
+
; Assume all-caps names are constants
|
|
10
|
+
((identifier) @constant
|
|
11
|
+
(#match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
|
12
|
+
|
|
13
|
+
; Assume uppercase names are enum constructors
|
|
14
|
+
((identifier) @constructor
|
|
15
|
+
(#match? @constructor "^[A-Z]"))
|
|
16
|
+
|
|
17
|
+
; Assume that uppercase names in paths are types
|
|
18
|
+
((scoped_identifier
|
|
19
|
+
path: (identifier) @type)
|
|
20
|
+
(#match? @type "^[A-Z]"))
|
|
21
|
+
((scoped_identifier
|
|
22
|
+
path: (scoped_identifier
|
|
23
|
+
name: (identifier) @type))
|
|
24
|
+
(#match? @type "^[A-Z]"))
|
|
25
|
+
((scoped_type_identifier
|
|
26
|
+
path: (identifier) @type)
|
|
27
|
+
(#match? @type "^[A-Z]"))
|
|
28
|
+
((scoped_type_identifier
|
|
29
|
+
path: (scoped_identifier
|
|
30
|
+
name: (identifier) @type))
|
|
31
|
+
(#match? @type "^[A-Z]"))
|
|
32
|
+
|
|
33
|
+
; Assume all qualified names in struct patterns are enum constructors. (They're
|
|
34
|
+
; either that, or struct names; highlighting both as constructors seems to be
|
|
35
|
+
; the less glaring choice of error, visually.)
|
|
36
|
+
(struct_pattern
|
|
37
|
+
type: (scoped_type_identifier
|
|
38
|
+
name: (type_identifier) @constructor))
|
|
39
|
+
|
|
40
|
+
; Function calls
|
|
41
|
+
|
|
42
|
+
(call_expression
|
|
43
|
+
function: (identifier) @function)
|
|
44
|
+
(call_expression
|
|
45
|
+
function: (field_expression
|
|
46
|
+
field: (field_identifier) @function.method))
|
|
47
|
+
(call_expression
|
|
48
|
+
function: (scoped_identifier
|
|
49
|
+
"::"
|
|
50
|
+
name: (identifier) @function))
|
|
51
|
+
|
|
52
|
+
(generic_function
|
|
53
|
+
function: (identifier) @function)
|
|
54
|
+
(generic_function
|
|
55
|
+
function: (scoped_identifier
|
|
56
|
+
name: (identifier) @function))
|
|
57
|
+
(generic_function
|
|
58
|
+
function: (field_expression
|
|
59
|
+
field: (field_identifier) @function.method))
|
|
60
|
+
|
|
61
|
+
(macro_invocation
|
|
62
|
+
macro: (identifier) @function.macro
|
|
63
|
+
"!" @function.macro)
|
|
64
|
+
|
|
65
|
+
; Function definitions
|
|
66
|
+
|
|
67
|
+
(function_item (identifier) @function)
|
|
68
|
+
(function_signature_item (identifier) @function)
|
|
69
|
+
|
|
70
|
+
(line_comment) @comment
|
|
71
|
+
(block_comment) @comment
|
|
72
|
+
|
|
73
|
+
(line_comment (doc_comment)) @comment.documentation
|
|
74
|
+
(block_comment (doc_comment)) @comment.documentation
|
|
75
|
+
|
|
76
|
+
"(" @punctuation.bracket
|
|
77
|
+
")" @punctuation.bracket
|
|
78
|
+
"[" @punctuation.bracket
|
|
79
|
+
"]" @punctuation.bracket
|
|
80
|
+
"{" @punctuation.bracket
|
|
81
|
+
"}" @punctuation.bracket
|
|
82
|
+
|
|
83
|
+
(type_arguments
|
|
84
|
+
"<" @punctuation.bracket
|
|
85
|
+
">" @punctuation.bracket)
|
|
86
|
+
(type_parameters
|
|
87
|
+
"<" @punctuation.bracket
|
|
88
|
+
">" @punctuation.bracket)
|
|
89
|
+
|
|
90
|
+
"::" @punctuation.delimiter
|
|
91
|
+
":" @punctuation.delimiter
|
|
92
|
+
"." @punctuation.delimiter
|
|
93
|
+
"," @punctuation.delimiter
|
|
94
|
+
";" @punctuation.delimiter
|
|
95
|
+
|
|
96
|
+
(parameter (identifier) @variable.parameter)
|
|
97
|
+
|
|
98
|
+
(lifetime (identifier) @label)
|
|
99
|
+
|
|
100
|
+
"as" @keyword
|
|
101
|
+
"async" @keyword
|
|
102
|
+
"await" @keyword
|
|
103
|
+
"break" @keyword
|
|
104
|
+
"const" @keyword
|
|
105
|
+
"continue" @keyword
|
|
106
|
+
"default" @keyword
|
|
107
|
+
"dyn" @keyword
|
|
108
|
+
"else" @keyword
|
|
109
|
+
"enum" @keyword
|
|
110
|
+
"extern" @keyword
|
|
111
|
+
"fn" @keyword
|
|
112
|
+
"for" @keyword
|
|
113
|
+
"gen" @keyword
|
|
114
|
+
"if" @keyword
|
|
115
|
+
"impl" @keyword
|
|
116
|
+
"in" @keyword
|
|
117
|
+
"let" @keyword
|
|
118
|
+
"loop" @keyword
|
|
119
|
+
"macro_rules!" @keyword
|
|
120
|
+
"match" @keyword
|
|
121
|
+
"mod" @keyword
|
|
122
|
+
"move" @keyword
|
|
123
|
+
"pub" @keyword
|
|
124
|
+
"raw" @keyword
|
|
125
|
+
"ref" @keyword
|
|
126
|
+
"return" @keyword
|
|
127
|
+
"static" @keyword
|
|
128
|
+
"struct" @keyword
|
|
129
|
+
"trait" @keyword
|
|
130
|
+
"type" @keyword
|
|
131
|
+
"union" @keyword
|
|
132
|
+
"unsafe" @keyword
|
|
133
|
+
"use" @keyword
|
|
134
|
+
"where" @keyword
|
|
135
|
+
"while" @keyword
|
|
136
|
+
"yield" @keyword
|
|
137
|
+
(crate) @keyword
|
|
138
|
+
(mutable_specifier) @keyword
|
|
139
|
+
(use_list (self) @keyword)
|
|
140
|
+
(scoped_use_list (self) @keyword)
|
|
141
|
+
(scoped_identifier (self) @keyword)
|
|
142
|
+
(super) @keyword
|
|
143
|
+
|
|
144
|
+
(self) @variable.builtin
|
|
145
|
+
|
|
146
|
+
(char_literal) @string
|
|
147
|
+
(string_literal) @string
|
|
148
|
+
(raw_string_literal) @string
|
|
149
|
+
|
|
150
|
+
(boolean_literal) @constant.builtin
|
|
151
|
+
(integer_literal) @constant.builtin
|
|
152
|
+
(float_literal) @constant.builtin
|
|
153
|
+
|
|
154
|
+
(escape_sequence) @escape
|
|
155
|
+
|
|
156
|
+
(attribute_item) @attribute
|
|
157
|
+
(inner_attribute_item) @attribute
|
|
158
|
+
|
|
159
|
+
"*" @operator
|
|
160
|
+
"&" @operator
|
|
161
|
+
"'" @operator
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
; ADT definitions
|
|
2
|
+
|
|
3
|
+
(struct_item
|
|
4
|
+
name: (type_identifier) @name) @definition.class
|
|
5
|
+
|
|
6
|
+
(enum_item
|
|
7
|
+
name: (type_identifier) @name) @definition.class
|
|
8
|
+
|
|
9
|
+
(union_item
|
|
10
|
+
name: (type_identifier) @name) @definition.class
|
|
11
|
+
|
|
12
|
+
; type aliases
|
|
13
|
+
|
|
14
|
+
(type_item
|
|
15
|
+
name: (type_identifier) @name) @definition.class
|
|
16
|
+
|
|
17
|
+
; method definitions
|
|
18
|
+
|
|
19
|
+
(declaration_list
|
|
20
|
+
(function_item
|
|
21
|
+
name: (identifier) @name) @definition.method)
|
|
22
|
+
|
|
23
|
+
; function definitions
|
|
24
|
+
|
|
25
|
+
(function_item
|
|
26
|
+
name: (identifier) @name) @definition.function
|
|
27
|
+
|
|
28
|
+
; trait definitions
|
|
29
|
+
(trait_item
|
|
30
|
+
name: (type_identifier) @name) @definition.interface
|
|
31
|
+
|
|
32
|
+
; module definitions
|
|
33
|
+
(mod_item
|
|
34
|
+
name: (identifier) @name) @definition.module
|
|
35
|
+
|
|
36
|
+
; macro definitions
|
|
37
|
+
|
|
38
|
+
(macro_definition
|
|
39
|
+
name: (identifier) @name) @definition.macro
|
|
40
|
+
|
|
41
|
+
; references
|
|
42
|
+
|
|
43
|
+
(call_expression
|
|
44
|
+
function: (identifier) @name) @reference.call
|
|
45
|
+
|
|
46
|
+
(call_expression
|
|
47
|
+
function: (field_expression
|
|
48
|
+
field: (field_identifier) @name)) @reference.call
|
|
49
|
+
|
|
50
|
+
(macro_invocation
|
|
51
|
+
macro: (identifier) @name) @reference.call
|
|
52
|
+
|
|
53
|
+
; implementations
|
|
54
|
+
|
|
55
|
+
(impl_item
|
|
56
|
+
trait: (type_identifier) @name) @reference.implementation
|
|
57
|
+
|
|
58
|
+
(impl_item
|
|
59
|
+
type: (type_identifier) @name
|
|
60
|
+
!trait) @reference.implementation
|
|
Binary file
|