@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.
@@ -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
@@ -11,6 +11,9 @@
11
11
  (supervisor_declaration)
12
12
  (machine_declaration)
13
13
  (extern_block)
14
+ (macro_declaration)
15
+ (macro_template)
16
+ (token_tree)
14
17
  (match_expression)
15
18
  (select_expression)
16
19
  (if_expression)