@hew-lang/tree-sitter-hew 1.1.1 → 1.2.1
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/README.md +6 -0
- package/grammar.js +212 -83
- package/package.json +1 -1
- package/queries/folds.scm +2 -0
- package/queries/highlights.scm +24 -3
- package/queries/indents.scm +3 -0
- package/src/grammar.json +1399 -377
- package/src/node-types.json +637 -68
- package/src/parser.c +160495 -100604
- package/tree-sitter.json +1 -1
package/queries/highlights.scm
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"fn" "let" "var" "const" "mut" "pub" "return" "if" "else" "match" "for" "while"
|
|
6
6
|
"loop" "break" "continue" "in" "spawn" "await" "select" "race"
|
|
7
7
|
"import" "extern" "gen" "yield" "scope" "move" "fork"
|
|
8
|
-
"type" "where" "dyn" "unsafe" "defer"
|
|
8
|
+
"type" "where" "dyn" "unsafe" "defer" "macro"
|
|
9
9
|
"init" "child" "pool" "restart" "wired_to"
|
|
10
10
|
"package" "after"
|
|
11
11
|
"reserved" "optional" "deprecated" "default"
|
|
@@ -20,9 +20,12 @@
|
|
|
20
20
|
; where `clone` stays an ordinary identifier.
|
|
21
21
|
(clone_expression "clone" @keyword.operator)
|
|
22
22
|
(callable_capabilities ["var" "once" "clone" "suspends"] @keyword)
|
|
23
|
+
(trait_method_effect "suspends" @keyword)
|
|
23
24
|
(private_capture_list "capture" @keyword)
|
|
24
25
|
(private_capture (identifier) @variable)
|
|
25
26
|
(failure_return "fails" @keyword)
|
|
27
|
+
(return_error_expression "error" @keyword)
|
|
28
|
+
(defer_statement "err" @keyword)
|
|
26
29
|
(child_clause ["count" "stop"] @keyword)
|
|
27
30
|
|
|
28
31
|
"receive" @keyword
|
|
@@ -59,7 +62,13 @@
|
|
|
59
62
|
(attribute "#" @punctuation.special)
|
|
60
63
|
(attribute "[" @punctuation.special)
|
|
61
64
|
(attribute "]" @punctuation.special)
|
|
62
|
-
(attribute (identifier) @attribute)
|
|
65
|
+
(attribute name: (identifier) @attribute)
|
|
66
|
+
|
|
67
|
+
(macro_declaration name: (identifier) @function.macro)
|
|
68
|
+
(macro_rule category: ["expr" "items"] @keyword)
|
|
69
|
+
(macro_function_capture ["fn" "method" "fails"] @keyword)
|
|
70
|
+
(macro_variable (identifier) @variable.parameter)
|
|
71
|
+
"$" @punctuation.special
|
|
63
72
|
|
|
64
73
|
; ---- Literals ----
|
|
65
74
|
(integer_literal) @number
|
|
@@ -92,6 +101,7 @@
|
|
|
92
101
|
|
|
93
102
|
(type_parameters "<" @punctuation.bracket)
|
|
94
103
|
(type_parameters ">" @punctuation.bracket)
|
|
104
|
+
(type_parameter (identifier) @type)
|
|
95
105
|
(machine_type_parameters "<" @punctuation.bracket)
|
|
96
106
|
(machine_type_parameters ">" @punctuation.bracket)
|
|
97
107
|
(const_parameter name: (identifier) @constant)
|
|
@@ -136,6 +146,9 @@
|
|
|
136
146
|
|
|
137
147
|
(self) @variable.builtin
|
|
138
148
|
|
|
149
|
+
(macro_invocation name: (identifier) @function.macro)
|
|
150
|
+
(macro_invocation name: (path_expression (identifier) @function.macro))
|
|
151
|
+
|
|
139
152
|
(field_expression
|
|
140
153
|
field: (identifier) @property)
|
|
141
154
|
|
|
@@ -196,6 +209,14 @@
|
|
|
196
209
|
|
|
197
210
|
(variant
|
|
198
211
|
name: (identifier) @constant)
|
|
212
|
+
(variant_tag "@" @punctuation.special)
|
|
213
|
+
(variant_tag (integer_literal) @number)
|
|
214
|
+
|
|
215
|
+
; `.Variant` and `.Variant { .. }` take their enum from the expected type.
|
|
216
|
+
(contextual_variant_expression
|
|
217
|
+
name: (identifier) @constant)
|
|
218
|
+
(contextual_variant_record_init
|
|
219
|
+
name: (identifier) @constant)
|
|
199
220
|
|
|
200
221
|
; ---- Struct init ----
|
|
201
222
|
(struct_init
|
|
@@ -222,7 +243,7 @@
|
|
|
222
243
|
; ---- Operators ----
|
|
223
244
|
[
|
|
224
245
|
"+" "-" "*" "/" "%" "!" "=" "==" "!=" "<" "<=" ">" ">=" "&&" "||"
|
|
225
|
-
"+=" "-=" "*=" "/=" "%=" ".." "..=" "=>" "->" "?" "??"
|
|
246
|
+
"+=" "-=" "*=" "/=" "%=" ".." "..=" "=>" "->" "?" "?." "??"
|
|
226
247
|
"<<" ">>" "&=" "|=" "^=" "<<=" ">>="
|
|
227
248
|
"&" "|" "^" "~" "is" "&+" "&-" "&*"
|
|
228
249
|
] @operator
|