Debian Codegraph @

runtime/queries/odin/highlights.scm

raw symbols SCIP
1
2 ; Variables
3
4 (identifier) @variable
5
6 [
7 (calling_convention)
8 (tag)
9 ] @keyword.directive
10
11 [
12 "import"
13 ] @keyword.control.import
14
15 [
16 "package"
17 "foreign"
18 "using"
19 "cast"
20 "transmute"
21 "auto_cast"
22 ] @keyword
23
24 [
25 "defer"
26 ] @keyword.control
27
28 [
29 "struct"
30 "enum"
31 "union"
32 "map"
33 "bit_set"
34 "matrix"
35 "bit_field"
36 ] @keyword.storage.type
37
38 [
39 "proc"
40 ] @keyword.function
41
42 [
43 "return"
44 "or_return"
45 ] @keyword.control.return
46
47 [
48 "distinct"
49 "dynamic"
50 ] @keyword.storage.modifier
51
52 [
53 "if"
54 "else"
55 "when"
56 "switch"
57 "case"
58 "where"
59 "break"
60 "or_break"
61 (fallthrough_statement)
62 ] @keyword.control.conditional
63
64 ((ternary_expression
65 [
66 "?"
67 ":"
68 "if"
69 "else"
70 "when"
71 ] @keyword.control.conditional))
72
73 [
74 "for"
75 "do"
76 "continue"
77 "or_continue"
78 ] @keyword.control.repeat
79
80 [
81 ":="
82 "="
83 "+"
84 "-"
85 "*"
86 "/"
87 "%"
88 "%%"
89 ">"
90 ">="
91 "<"
92 "<="
93 "=="
94 "!="
95 "~="
96 "|"
97 "~"
98 "&"
99 "&~"
100 "<<"
101 ">>"
102 "||"
103 "&&"
104 "!"
105 "^"
106 ".."
107 "+="
108 "-="
109 "*="
110 "/="
111 "%="
112 "&="
113 "|="
114 "^="
115 "<<="
116 ">>="
117 "||="
118 "&&="
119 "&~="
120 "..="
121 "..<"
122 "?"
123 ] @operator
124
125 [
126 "or_else"
127 "in"
128 "not_in"
129 ] @keyword.operator
130
131 [ "{" "}" ] @punctuation.bracket
132
133 [ "(" ")" ] @punctuation.bracket
134
135 [ "[" "]" ] @punctuation.bracket
136
137 [
138 "::"
139 "->"
140 "."
141 ","
142 ":"
143 ";"
144 ] @punctuation.delimiter
145
146 [
147 "@"
148 "$"
149 ] @punctuation.special
150
151 (number) @constant.numeric
152
153 (float) @constant.numeric.float
154
155 (string) @string
156
157 (character) @string
158
159 (escape_sequence) @constant.character.escape
160
161 (boolean) @constant.builtin.boolean
162
163 [
164 (uninitialized)
165 (nil)
166 ] @constant.builtin
167
168 ((identifier) @variable.builtin
169 (#any-of? @variable.builtin "context" "self"))
170
171 (((identifier) @type.builtin)
172 (#any-of? @type.builtin
173 "bool" "byte" "b8" "b16" "b32" "b64"
174 "int" "i8" "i16" "i32" "i64" "i128"
175 "uint" "u8" "u16" "u32" "u64" "u128" "uintptr"
176 "i16le" "i32le" "i64le" "i128le" "u16le" "u32le" "u64le" "u128le"
177 "i16be" "i32be" "i64be" "i128be" "u16be" "u32be" "u64be" "u128be"
178 "float" "double" "f16" "f32" "f64" "f16le" "f32le" "f64le" "f16be" "f32be" "f64be"
179 "complex32" "complex64" "complex128" "complex_float" "complex_double"
180 "quaternion64" "quaternion128" "quaternion256"
181 "rune" "string" "cstring" "rawptr" "typeid" "any"))
182
183 "..." @type.builtin
184
185 [
186 (comment)
187 (block_comment)
188 ] @comment
189
190 ; Functions
191
192 (procedure_declaration (identifier) @function)
193
194 (procedure_declaration (identifier) @function (procedure (block)))
195
196 (procedure_declaration (identifier) @function (procedure (uninitialized)))
197
198 (overloaded_procedure_declaration (identifier) @function)
199
200 (call_expression function: (identifier) @function)
201
202 (call_expression
203 function: (identifier) @function.builtin
204 (#any-of? @function.builtin
205 "abs" "align_of" "append" "append_elem" "append_elem_string"
206 "append_elems" "append_nothing" "append_soa" "append_soa_elem"
207 "append_soa_elems" "append_string" "assert" "assert_contextless"
208 "assign_at" "assign_at_elem" "assign_at_elem_string" "assign_at_elems"
209 "cap" "card" "clamp" "clear" "clear_dynamic_array" "clear_map" "clear_soa"
210 "complex" "conj" "container_of" "copy" "copy_from_string" "copy_slice"
211 "delete" "delete_cstring" "delete_dynamic_array" "delete_key"
212 "delete_map" "delete_slice" "delete_soa" "delete_string"
213 "expand_values" "free" "free_all" "imag" "init_global_temporary_allocator"
214 "inject_at" "inject_at_elem" "inject_at_elem_string" "inject_at_elems"
215 "jmag" "kmag" "len" "make" "make_dynamic_array" "make_dynamic_array_len"
216 "make_dynamic_array_len_cap" "make_map" "make_multi_pointer" "make_slice"
217 "make_soa" "make_soa_aligned" "make_soa_dynamic_array"
218 "make_soa_dynamic_array_len" "make_soa_dynamic_array_len_cap"
219 "make_soa_slice" "map_insert" "map_upsert" "max" "min"
220 "new_clone" "non_zero_append" "non_zero_append_elem"
221 "non_zero_append_elem_string" "non_zero_append_elems"
222 "non_zero_append_soa_elem" "non_zero_append_soa_elems"
223 "non_zero_resize" "non_zero_resize_dynamic_array" "non_zero_resize_soa"
224 "non_zero_reserve" "non_zero_reserve_dynamic_array" "non_zero_reserve_soa"
225 "offset_of" "offset_of_by_string" "offset_of_member" "offset_of_selector"
226 "ordered_remove" "panic" "panic_contextless" "pop" "pop_front"
227 "pop_front_safe" "pop_safe" "raw_data" "raw_soa_footer_dynamic_array"
228 "raw_soa_footer_slice" "real" "remove_range" "reserve"
229 "reserve_dynamic_array" "reserve_map" "reserve_soa" "resize"
230 "resize_dynamic_array" "resize_soa" "shrink" "shrink_map"
231 "size_of" "soa_unzip" "soa_zip" "swizzle" "type_info_of" "type_of"
232 "typeid_of" "unordered_remove" "unordered_remove_soa"
233 "unimplemented" "unimplemented_contextless"))
234
235 ; Types
236
237 (struct_declaration (identifier) @type "::")
238
239 (enum_declaration (identifier) @type "::")
240
241 (union_declaration (identifier) @type "::")
242
243 (bit_field_declaration (identifier) @type "::")
244
245 (const_declaration (identifier) @type "::" [(array_type) (distinct_type) (bit_set_type) (pointer_type)])
246
247 (struct . (identifier) @type)
248
249 (field_type . (identifier) @keyword.storage.type "." (identifier) @type)
250
251 (bit_set_type (identifier) @type ";")
252
253 (polymorphic_parameters (identifier) @type)
254
255 ((identifier) @type
256 (#match? @type "^[A-Z][a-z0-9_]+"))
257
258 (type (identifier) @type)
259
260 ; Constants
261
262 (member_expression . "." (identifier) @constant)
263
264 (enum_declaration "{" (identifier) @constant)
265
266 ((identifier) @constant
267 (#match? @constant "^[A-Z0-9_]*$"))
268
269 ; Attributes
270
271 (attribute (identifier) @attribute "="?)
272
273 ; Labels
274
275 (label_statement (identifier) @label ":")
276
277 ; Fields
278
279 (member_expression "." (identifier) @variable.other.member)
280 (member_expression
281 (identifier) "."
282 (call_expression
283 function: (identifier) @function.method))
284
285 (struct_type "{" (identifier) @variable.other.member)
286
287 (struct_field (identifier) @variable.other.member "="?)
288
289 (bit_field_declaration (identifier) @variable.other.member)
290
291 (field (identifier) @variable.other.member)
292
293 ; Namespaces
294
295 (package_declaration (identifier) @namespace)
296
297 (foreign_block (identifier) @namespace)
298
299 (using_statement (identifier) @namespace)
300
301 (import_declaration (identifier) @namespace)
302
303 ; Parameters
304
305 (parameter (identifier) @variable.parameter ":" "="? (identifier)? @constant)
306
307 (default_parameter (identifier) @variable.parameter ":=")
308
309 (named_type (identifier) @variable.parameter)
310
311 (call_expression argument: (identifier) @variable.parameter "=")
312
313 (procedure_type (parameters (parameter (identifier) @variable.parameter)))