Debian Codegraph @

runtime/queries/systemverilog/highlights.scm

raw symbols SCIP
1 ;; Comments
2 (one_line_comment) @comment
3 (block_comment) @comment
4
5
6 ;; Strings
7 (string_literal) @string
8 (quoted_string) @string ; `include strings
9 (system_lib_string) @string
10
11
12 ;; Keywords
13 (["begin" "end"]) @keyword
14 ("this") @variable.builtin
15 (["input" "output" "inout" "ref"]) @keyword
16 (["alias" "and" "assert" "assign" "assume" "before" "bind" "binsof" "break"
17 "case" "checker" "class" "class" "clocking" "config" "const" "constraint"
18 "cover" "covergroup" "coverpoint" "cross" "default" "defparam" "disable"
19 "do" "else" "endcase" "endchecker" "endclass" "endclocking" "endconfig"
20 "endfunction" "endgenerate" "endgroup" "endinterface" "endmodule"
21 "endpackage" "endprogram" "endproperty" "endsequence" "endtask" "enum"
22 "extends" "extern" "final" "first_match" "for" "force" "foreach" "forever"
23 "fork" "forkjoin" "function" "generate" "genvar" "if" "iff" "illegal_bins"
24 "implements" "import" "initial" "inside" "interconnect" "interface"
25 "intersect" "join" "join_any" "join_none" "local" "localparam" "matches"
26 "modport" "new" "null" "option" "or" "package" "packed" "parameter"
27 "program" "property" "pure" "randcase" "randomize" "release" "repeat"
28 "return" "sequence" "showcancelled" "soft" "solve" "struct" "super" "tagged"
29 "task" "timeprecision" "timeunit" "type" "typedef" "union" "unique"
30 "virtual" "wait" "while" "with"
31 (always_keyword) ; always, always_comb, always_latch, always_ff
32 (bins_keyword) ; bins, illegal_bins, ignore_bins
33 (case_keyword) ; case, casez, casex
34 (class_item_qualifier) ; static, protected, local
35 (edge_identifier) ; posedge, negedge, edge
36 (lifetime) ; static, automatic
37 (module_keyword) ; module, macromodule
38 (random_qualifier) ; rand, randc
39 (unique_priority)]) @keyword ; unique, unique0, priority
40
41
42 ;; Preprocessor directives and macro usage
43 (["`include" "`define" "`ifdef" "`ifndef" "`timescale" "`default_nettype"
44 "`elsif" "`undef" (resetall_compiler_directive) (undefineall_compiler_directive)
45 "`endif" "`else" "`unconnected_drive" (celldefine_compiler_directive)
46 (endcelldefine_compiler_directive) (endkeywords_directive) "`line"
47 "`begin_keywords" "`pragma" "`__FILE__" "`__LINE__"]) @string.special
48 (text_macro_usage
49 (simple_identifier) @string.special)
50
51
52 ;; Delimiters, operators
53 ([";" ":" "," "::"
54 "=" "?" "|=" "&=" "^="
55 "|->" "|=>" "->"
56 ":=" ":/" "-:" "+:"]) @punctuation.delimiter
57 (["(" ")"]) @punctuation.bracket
58 (["[" "]"]) @punctuation.bracket
59 (["{" "}" "'{"]) @punctuation.bracket
60
61 (["."] @operator)
62 (["+" "-" "*" "/" "%" "**"]) @operator
63 (["<" "<=" ">" ">="]) @operator
64 (["===" "!==" "==" "!="]) @operator
65 (["&&" "||" "!"]) @operator
66 (["~" "&" "~&" "|" "~|" "^" "~^"]) @operator
67 (["<<" ">>" "<<<" ">>>"]) @operator
68
69 (["@" "#" "##"]) @operator
70 (assignment_operator) @operator
71 (unary_operator) @operator
72 (inc_or_dec_operator) @operator
73 (stream_operator) @operator
74 (event_trigger) @operator
75 (["->" "->>"]) @operator
76
77
78 ;; Declarations
79 ;; Module/interface/program/package/class/checker
80 (module_nonansi_header
81 name: (simple_identifier) @function)
82 (module_ansi_header
83 name: (simple_identifier) @function)
84 (interface_nonansi_header
85 name: (simple_identifier) @function)
86 (interface_ansi_header
87 name: (simple_identifier) @function)
88 (program_nonansi_header
89 name: (simple_identifier) @function)
90 (program_ansi_header
91 name: (simple_identifier) @function)
92 (package_declaration
93 name: (simple_identifier) @function)
94 (class_declaration
95 name: (simple_identifier) @function)
96 (interface_class_declaration
97 name: (simple_identifier) @function)
98 (checker_declaration
99 name: (simple_identifier) @function)
100 (class_declaration
101 (class_type
102 (simple_identifier) @type)) ; Parent class
103 ;; Function/task/methods
104 (function_body_declaration
105 name: (simple_identifier) @function)
106 (task_body_declaration
107 name: (simple_identifier) @function)
108 (function_prototype
109 (data_type_or_void)
110 name: (simple_identifier) @function)
111 (task_prototype
112 name: (simple_identifier) @function)
113 (class_scope ; Definition of extern defined methods
114 (class_type
115 (simple_identifier)) @function)
116
117
118 ;; Types
119 [(integer_vector_type) ; bit, logic, reg
120 (integer_atom_type) ; byte, shortint, int, longint, integer, time
121 (non_integer_type) ; shortreal, real, realtime
122 (net_type) ; supply0, supply1, tri, triand, trior, trireg, tri0, tri1, uwire, wire, wand, wor
123 ["string" "event" "signed" "unsigned" "chandle"]] @type
124 (data_type_or_implicit
125 (data_type
126 (simple_identifier)) @type)
127 (data_type
128 (class_type
129 (simple_identifier) @type
130 (parameter_value_assignment)))
131 (data_type
132 (class_type
133 (simple_identifier) @operator
134 (simple_identifier) @type))
135 (net_port_header
136 (net_port_type
137 (simple_identifier) @type))
138 (variable_port_header
139 (variable_port_type
140 (data_type
141 (simple_identifier) @type)))
142 (["void'" (data_type_or_void)]) @type ; void cast of task called as a function
143 (interface_port_header ; Interfaces with modports
144 interface_name: (simple_identifier) @type
145 modport_name: (simple_identifier) @type)
146 (type_assignment
147 name: (simple_identifier) @type)
148 (net_declaration ; User type variable declaration
149 (simple_identifier) @type)
150 (enum_base_type ; Enum base type with user type
151 (simple_identifier) @type)
152
153
154 ;; Instances
155 ;; Module names
156 (module_instantiation
157 instance_type: (simple_identifier) @namespace)
158 (interface_instantiation
159 instance_type: (simple_identifier) @namespace)
160 (program_instantiation
161 instance_type: (simple_identifier) @namespace)
162 (checker_instantiation
163 instance_type: (simple_identifier) @namespace)
164 (udp_instantiation
165 instance_type: (simple_identifier) @namespace)
166 (gate_instantiation
167 [(cmos_switchtype)
168 (mos_switchtype)
169 (enable_gatetype)
170 (n_input_gatetype)
171 (n_output_gatetype)
172 (pass_en_switchtype)
173 (pass_switchtype)
174 "pulldown" "pullup"]
175 @namespace)
176 ;; Instance names
177 (name_of_instance
178 instance_name: (simple_identifier) @constant)
179 ;; Instance parameters
180 (module_instantiation
181 (parameter_value_assignment
182 (list_of_parameter_value_assignments
183 (named_parameter_assignment
184 (simple_identifier) @constant))))
185 (module_instantiation
186 (parameter_value_assignment
187 (list_of_parameter_value_assignments
188 (ordered_parameter_assignment
189 (param_expression
190 (data_type
191 (simple_identifier) @constant))))))
192 ;; Port names
193 (named_port_connection
194 port_name: (simple_identifier) @constant)
195 (named_parameter_assignment
196 (simple_identifier) @constant)
197 (named_checker_port_connection
198 port_name: (simple_identifier) @constant)
199 ;; Bind statements
200 (bind_directive
201 (bind_target_scope
202 (simple_identifier) @constant))
203
204
205 ;; Numbers
206 (hex_number
207 size: (unsigned_number) @constant.numeric
208 base: (hex_base) @punctuation.delimiter)
209 (decimal_number
210 size: (unsigned_number) @constant.numeric
211 base: (decimal_base) @punctuation.delimiter)
212 (octal_number
213 size: (unsigned_number) @constant.numeric
214 base: (octal_base) @punctuation.delimiter)
215 (binary_number
216 size: (unsigned_number) @constant.numeric
217 base: (binary_base) @punctuation.delimiter)
218 ;; Same as before but without the width (width extension)
219 (hex_number
220 base: (hex_base) @punctuation.delimiter)
221 (decimal_number
222 base: (decimal_base) @punctuation.delimiter)
223 (octal_number
224 base: (octal_base) @punctuation.delimiter)
225 (binary_number
226 base: (binary_base) @punctuation.delimiter)
227
228
229 ;; Arrays
230 (unpacked_dimension
231 [(constant_expression) (constant_range)] @constant.numeric)
232 (packed_dimension
233 (constant_range) @constant.numeric)
234 (select
235 (constant_range) @constant.numeric)
236 (constant_select
237 (constant_range
238 (constant_expression) @constant.numeric))
239 (constant_bit_select
240 (constant_expression) @constant.numeric)
241 (bit_select
242 (expression) @constant.numeric)
243 (indexed_range
244 (expression) @constant.numeric
245 (constant_expression) @constant.numeric)
246 (constant_indexed_range
247 (constant_expression) @constant.numeric)
248 (value_range ; inside {[min_range:max_range]}, place here to apply override
249 (expression) @constant)
250 (dynamic_array_new
251 (expression) @constant)
252
253
254 ;; Misc
255 ;; Timeunit
256 ((time_unit) @constant.builtin)
257 ;; Enum labels
258 (enum_name_declaration
259 (simple_identifier) @constant.builtin)
260 ;; Case item label (not radix)
261 (case_item_expression
262 (expression
263 (primary
264 (hierarchical_identifier
265 (simple_identifier) @constant.builtin))))
266 ;; Hierarchical references, interface signals, class members, package scope
267 (hierarchical_identifier
268 (simple_identifier) @punctuation.delimiter
269 "."
270 (simple_identifier))
271 (method_call
272 (primary) @punctuation.delimiter
273 (["." "::"])
274 (method_call_body))
275 (package_scope
276 (simple_identifier) @punctuation.delimiter)
277 (method_call
278 (primary
279 (select
280 (simple_identifier) @punctuation.delimiter))
281 (method_call_body))
282 ;; Attributes
283 (["(*" "*)"] @constant)
284 (attribute_instance
285 (attr_spec (simple_identifier) @attribute))
286 ;; Typedefs
287 (type_declaration
288 (class_type (simple_identifier) @type)
289 type_name: (simple_identifier) @constant)
290 (type_declaration
291 type_name: (simple_identifier) @constant)
292 ("typedef" "class" (simple_identifier) @constant)
293 ;; Coverpoint & cross labels
294 (cover_point
295 name: (simple_identifier) @constant)
296 (cover_cross
297 name: (simple_identifier) @constant)
298 ;; Loop variables (foreach[i])
299 (loop_variables
300 (simple_identifier) @constant)
301 ;; Bins values
302 (bins_or_options
303 (expression
304 (primary
305 (concatenation
306 (expression) @constant))))
307 ;; Bins ranges
308 (covergroup_value_range
309 (expression) @constant)
310 ;; Queue dimension
311 (("$") @punctuation.special)
312 ;; Parameterized classes (e.g: uvm_config_db #(axi_stream_agent_config))
313 (class_type
314 (parameter_value_assignment
315 (list_of_parameter_value_assignments) @punctuation.delimiter))
316
317
318 ;; System-tf
319 ([(system_tf_identifier) ; System task/function
320 "$fatal" "$error" "$warning" "$info" ; (severity_system_task)
321 "$stop" "$finish" "$exit"]) ; (simulation_control_task)
322 @function.builtin