Mercurial > dotfiles
comparison dot_config/helix/runtime/queries/verilog/highlights.scm @ 1079:6b04ecaaff0f draft
feat: add better systemverilog treesitter
author | Zeger Van de Vannet <zeger@vandevan.net> |
---|---|
date | Tue, 07 Jan 2025 09:11:41 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1078:1fcc8b0ca8e2 | 1079:6b04ecaaff0f |
---|---|
1 ; ; Keywords | |
2 | |
3 [ | |
4 ; block delimiters | |
5 (module_keyword) | |
6 "endmodule" | |
7 "program" | |
8 "endprogram" | |
9 "class" | |
10 "endclass" | |
11 "interface" | |
12 "endinterface" | |
13 "package" | |
14 "endpackage" | |
15 "checker" | |
16 "endchecker" | |
17 "config" | |
18 "endconfig" | |
19 | |
20 "pure" | |
21 "virtual" | |
22 "extends" | |
23 "implements" | |
24 "super" | |
25 (class_item_qualifier) | |
26 | |
27 "parameter" | |
28 "localparam" | |
29 "defparam" | |
30 "assign" | |
31 "typedef" | |
32 "modport" | |
33 "fork" | |
34 "join" | |
35 "join_none" | |
36 "join_any" | |
37 "default" | |
38 "break" | |
39 "assert" | |
40 (unique_priority) | |
41 "tagged" | |
42 "extern" | |
43 ] @keyword | |
44 | |
45 [ | |
46 "function" | |
47 "endfunction" | |
48 | |
49 "task" | |
50 "endtask" | |
51 ] @keyword.function | |
52 | |
53 "return" @keyword.control.return | |
54 | |
55 [ | |
56 "begin" | |
57 "end" | |
58 ] @label | |
59 | |
60 [ | |
61 (always_keyword) | |
62 "generate" | |
63 "for" | |
64 "foreach" | |
65 "repeat" | |
66 "forever" | |
67 "initial" | |
68 "while" | |
69 ] @keyword.control | |
70 | |
71 [ | |
72 "if" | |
73 "else" | |
74 (case_keyword) | |
75 "endcase" | |
76 ] @keyword.control.conditional | |
77 | |
78 (comment) @comment | |
79 | |
80 (include_compiler_directive) @keyword.directive | |
81 (package_import_declaration | |
82 "import" @keyword.control.import) | |
83 | |
84 (package_import_declaration | |
85 (package_import_item | |
86 (simple_identifier) @namespace)) | |
87 | |
88 (package_scope | |
89 (simple_identifier) @namespace) | |
90 | |
91 ; TODO: match the constant name after :: as constant too | |
92 (package_import_declaration | |
93 (package_import_item | |
94 "*" @constant)) | |
95 | |
96 (package_declaration | |
97 (simple_identifier) @namespace) | |
98 | |
99 ; (text_macro_definition) @keyword.directive | |
100 | |
101 ; (text_macro_identifier | |
102 ; (simple_identifier) @keyword.directive) | |
103 | |
104 ; [ | |
105 ; (id_directive) | |
106 ; (zero_directive) | |
107 ; ] @keyword.directive | |
108 | |
109 (parameter_port_list | |
110 "#" @constructor) | |
111 | |
112 (param_assignment | |
113 (simple_identifier) @variable.parameter) | |
114 | |
115 (interface_port_header | |
116 (simple_identifier) @type.parameter) | |
117 | |
118 [ | |
119 "=" | |
120 "-" | |
121 "+" | |
122 "/" | |
123 "*" | |
124 "^" | |
125 "&" | |
126 "|" | |
127 "&&" | |
128 "||" | |
129 ":" | |
130 (unary_operator) | |
131 "{" | |
132 "}" | |
133 "'{" | |
134 "<=" | |
135 "@" | |
136 "or" | |
137 "and" | |
138 "==" | |
139 "!=" | |
140 "===" | |
141 "!==" | |
142 "-:" | |
143 "<" | |
144 ">" | |
145 ">=" | |
146 "%" | |
147 ">>" | |
148 "<<" | |
149 "|=" | |
150 (inc_or_dec_operator) | |
151 ] @keyword.operator | |
152 | |
153 (cast | |
154 ["'" "(" ")"] @keyword.operator) | |
155 | |
156 (cast | |
157 (casting_type) @type) | |
158 | |
159 ; (edge_identifier) @constant | |
160 | |
161 [ | |
162 (port_direction) | |
163 (input_declaration) | |
164 (output_declaration) | |
165 ] @label | |
166 | |
167 ; (port_identifier) @variable.parameter | |
168 | |
169 | |
170 [ | |
171 (net_type) | |
172 (integer_vector_type) | |
173 (integer_atom_type) | |
174 ] @type.builtin | |
175 | |
176 [ | |
177 "signed" | |
178 "unsigned" | |
179 ] @label | |
180 | |
181 (data_type | |
182 (simple_identifier) @type) | |
183 | |
184 ; (method_call_body | |
185 ; (method_identifier) @variable.other.member) | |
186 | |
187 ; (interface_identifier | |
188 ; (simple_identifier) @type) | |
189 | |
190 ; (modport_identifier | |
191 ; (modport_identifier | |
192 ; (simple_identifier) @variable.other.member)) | |
193 | |
194 ; (net_port_type1 | |
195 ; (simple_identifier) @type) | |
196 | |
197 [ | |
198 ; (double_quoted_string) | |
199 (string_literal) | |
200 ] @string | |
201 | |
202 [ | |
203 (include_compiler_directive) | |
204 (default_nettype_compiler_directive) | |
205 (timescale_compiler_directive) | |
206 ] @keyword.directive | |
207 | |
208 ; begin/end label | |
209 (seq_block | |
210 (simple_identifier) @comment) | |
211 (generate_block | |
212 (simple_identifier) @comment) | |
213 | |
214 [ | |
215 ";" | |
216 "::" | |
217 "," | |
218 "." | |
219 ] @punctuation.delimiter | |
220 | |
221 | |
222 (default_nettype_compiler_directive | |
223 (default_nettype_value) @string) | |
224 | |
225 ; (text_macro_identifier | |
226 ; (simple_identifier) @function.macro) | |
227 | |
228 (module_declaration | |
229 (module_ansi_header | |
230 (simple_identifier) @constructor)) | |
231 | |
232 (class_constructor_declaration | |
233 "new" @constructor) | |
234 | |
235 ; (parameter_identifier | |
236 ; (simple_identifier) @variable.parameter) | |
237 | |
238 [ | |
239 (integral_number) | |
240 (unsigned_number) | |
241 (unbased_unsized_literal) | |
242 ] @constant.numeric.integer | |
243 | |
244 (real_number | |
245 (fixed_point_number) @constant.numeric.float) | |
246 | |
247 (time_unit) @constant | |
248 | |
249 (constant_primary | |
250 (simple_identifier) @constant) | |
251 | |
252 ; (checker_instantiation | |
253 ; (checker_identifier | |
254 ; (simple_identifier) @constructor)) | |
255 | |
256 (module_instantiation | |
257 (simple_identifier) @type) | |
258 | |
259 ; (name_of_instance | |
260 ; (instance_identifier | |
261 ; (simple_identifier) @variable)) | |
262 | |
263 ; (interface_port_declaration | |
264 ; (interface_identifier | |
265 ; (simple_identifier) @type)) | |
266 | |
267 (net_declaration | |
268 (simple_identifier) @type) | |
269 | |
270 (lifetime) @label | |
271 | |
272 (function_declaration | |
273 (function_body_declaration | |
274 (simple_identifier) @function | |
275 (tf_port_list | |
276 (tf_port_item | |
277 (simple_identifier) @variable.parameter)))) | |
278 | |
279 (function_subroutine_call | |
280 (subroutine_call | |
281 (tf_call | |
282 (hierarchical_identifier | |
283 (simple_identifier) @function) | |
284 (list_of_arguments | |
285 (simple_identifier) @variable.parameter)))) | |
286 | |
287 (system_tf_call | |
288 (system_tf_identifier) @function.builtin) | |
289 | |
290 ; (task_identifier | |
291 ; (task_identifier | |
292 ; (simple_identifier) @function.method)) | |
293 | |
294 ;;TODO: fixme | |
295 ;(assignment_pattern_expression | |
296 ;(assignment_pattern | |
297 ;(parameter_identifier) @variable.other.member)) | |
298 | |
299 (type_declaration | |
300 (data_type ["packed"] @keyword.storage.modifier)) | |
301 | |
302 (struct_union) @type | |
303 | |
304 [ | |
305 "enum" | |
306 ] @type.enum | |
307 | |
308 (enum_name_declaration | |
309 (simple_identifier) @constant) | |
310 | |
311 (type_declaration | |
312 (simple_identifier) @type) | |
313 | |
314 [ | |
315 (integer_atom_type) | |
316 (non_integer_type) | |
317 "genvar" | |
318 ] @type.builtin | |
319 | |
320 (struct_union_member | |
321 (list_of_variable_decl_assignments | |
322 (variable_decl_assignment | |
323 (simple_identifier) @variable.other.member))) | |
324 | |
325 ; (member_identifier | |
326 ; (simple_identifier) @variable.other.member) | |
327 | |
328 (struct_union_member | |
329 (data_type_or_void | |
330 (data_type | |
331 (simple_identifier) @type))) | |
332 | |
333 (type_declaration | |
334 (simple_identifier) @type) | |
335 | |
336 ; (generate_block_identifier) @comment | |
337 | |
338 [ | |
339 "[" | |
340 "]" | |
341 "(" | |
342 ")" | |
343 ] @punctuation.bracket | |
344 | |
345 (attribute_instance) @attribute | |
346 (attribute_instance | |
347 (attr_spec) @label) | |
348 | |
349 (ERROR) @error |