Debian Codegraph @

runtime/queries/d/highlights.scm

raw symbols SCIP
1 ; highlights.scm
2 ;
3 ; Highlighting queries for D code for use by Tree-Sitter.
4 ;
5 ; Copyright 2022 Garrett D'Amore
6 ;
7 ; Distributed under the MIT License.
8 ; (See accompanying file LICENSE.txt or https://opensource.org/licenses/MIT)
9 ; SPDX-License-Identifier: MIT
10
11 (identifier) @variable
12
13 ; these are listed first, because they override keyword queries
14 (identity_expression (in) @operator)
15 (identity_expression (is) @operator)
16
17 (storage_class) @keyword.storage
18
19 (function_declaration (identifier) @function)
20
21 (call_expression (identifier) @function)
22 (call_expression (type (identifier) @function))
23
24 ; Member access `o.field`: the trailing identifier of a property expression
25 ; (anchored so the receiver isn't captured). Method calls parse as a
26 ; call_expression and keep @function above.
27 (property_expression (identifier) @variable.other.member .)
28
29 (module_fqn) @namespace
30
31 [
32 (abstract)
33 (alias)
34 (align)
35 (asm)
36 (assert)
37 (auto)
38 (cast)
39 (const)
40 (debug)
41 (delete)
42 (deprecated)
43 (export)
44 (extern)
45 (final)
46 (immutable)
47 (in)
48 (inout)
49 (invariant)
50 (is)
51 (lazy)
52 ; "macro" - obsolete
53 (mixin)
54 (module)
55 (new)
56 (nothrow)
57 (out)
58 (override)
59 (package)
60 (pragma)
61 (private)
62 (protected)
63 (public)
64 (pure)
65 (ref)
66 (scope)
67 (shared)
68 (static)
69 (super)
70 (synchronized)
71 (template)
72 (this)
73 (throw)
74 (typeid)
75 (typeof)
76 (unittest)
77 (version)
78 (with)
79 (gshared)
80 (traits)
81 (vector)
82 (parameters_)
83 ] @keyword
84
85 [
86 (class)
87 (struct)
88 (interface)
89 (union)
90 (enum)
91 (function)
92 (delegate)
93 ] @keyword.storage.type
94
95 [
96 (break)
97 (case)
98 (catch)
99 (continue)
100 (do)
101 (default)
102 (finally)
103 (else)
104 (goto)
105 (if)
106 (switch)
107 (try)
108 ] @keyword.control
109
110 (return) @keyword.control.return
111
112 (import) @keyword.control.import
113
114 [
115 (for)
116 (foreach)
117 (foreach_reverse)
118 (while)
119 ] @keyword.control.repeat
120
121 [
122 (not_in)
123 (not_is)
124 "/="
125 "/"
126 ".."
127 "..."
128 "&"
129 "&="
130 "&&"
131 "|"
132 "|="
133 "||"
134 "-"
135 "-="
136 "--"
137 "+"
138 "+="
139 "++"
140 "<"
141 "<="
142 "<<"
143 "<<="
144 ">"
145 ">="
146 ">>="
147 ">>>="
148 ">>"
149 ">>>"
150 "!"
151 "!="
152 "?"
153 "$"
154 "="
155 "=="
156 "*"
157 "*="
158 "%"
159 "%="
160 "^"
161 "^="
162 "^^"
163 "^^="
164 "~"
165 "~="
166 "@"
167 "=>"
168 ] @operator
169
170 [
171 "("
172 ")"
173 "["
174 "]"
175 ] @punctuation.bracket
176
177 [
178 ";"
179 "."
180 ":"
181 ","
182 ] @punctuation.delimiter
183
184 [
185 (true)
186 (false)
187 ] @constant.builtin.boolean
188
189 (null) @constant.builtin
190
191 (special_keyword) @constant.builtin
192
193 (directive) @keyword.directive
194 (shebang) @keyword.directive
195
196 (comment) @comment
197
198 [
199 (void)
200 (bool)
201 (byte)
202 (ubyte)
203 (char)
204 (short)
205 (ushort)
206 (wchar)
207 (dchar)
208 (int)
209 (uint)
210 (long)
211 (ulong)
212 (real)
213 (double)
214 (noreturn)
215 (size_t)
216 (ptrdiff_t)
217 ] @type.builtin
218
219 [
220 (cent)
221 (ucent)
222 (ireal)
223 (idouble)
224 (ifloat)
225 (creal)
226 (double)
227 (cfloat)
228 ] @warning ; these types are deprecated
229
230 ; Named arguments `foo(name: value)` (D named-args proposal).
231 (named_argument
232 (identifier) @variable.parameter)
233
234 (label (identifier) @label)
235 (goto_statement (goto) @keyword (identifier) @label)
236
237 (string_literal) @string
238 (escape_sequence) @constant.character.escape
239 ; Interpolated strings `i"…$(expr)…"`: reset the embedded expression so it isn't
240 ; coloured as part of the string.
241 (interpolation_expression) @none
242 (int_literal) @constant.numeric.integer
243 (float_literal) @constant.numeric.float
244 (char_literal) @constant.character
245 (at_attribute) @attribute
246
247 ; everything after __EOF_ is plain text
248 (end_file) @ui.text