@@ -0,0 +1,231 @@
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+; these are listed first, because they override keyword queries
12+(identity_expression (in) @operator)
13+(identity_expression (is) @operator)
14+
15+(storage_class) @keyword.storage
16+
17+(function_declaration (identifier) @function)
18+
19+(call_expression (identifier) @function)
20+(call_expression (type (identifier) @function))
21+
22+(module_fqn) @namespace
23+
24+[
25+ (abstract)
26+ (alias)
27+ (align)
28+ (asm)
29+ (assert)
30+ (auto)
31+ (cast)
32+ (const)
33+ (debug)
34+ (delete)
35+ (deprecated)
36+ (export)
37+ (extern)
38+ (final)
39+ (immutable)
40+ (in)
41+ (inout)
42+ (invariant)
43+ (is)
44+ (lazy)
45+ ; "macro" - obsolete
46+ (mixin)
47+ (module)
48+ (new)
49+ (nothrow)
50+ (out)
51+ (override)
52+ (package)
53+ (pragma)
54+ (private)
55+ (protected)
56+ (public)
57+ (pure)
58+ (ref)
59+ (scope)
60+ (shared)
61+ (static)
62+ (super)
63+ (synchronized)
64+ (template)
65+ (this)
66+ (throw)
67+ (typeid)
68+ (typeof)
69+ (unittest)
70+ (version)
71+ (with)
72+ (gshared)
73+ (traits)
74+ (vector)
75+ (parameters_)
76+] @keyword
77+
78+[
79+ (class)
80+ (struct)
81+ (interface)
82+ (union)
83+ (enum)
84+ (function)
85+ (delegate)
86+] @keyword.storage.type
87+
88+[
89+ (break)
90+ (case)
91+ (catch)
92+ (continue)
93+ (do)
94+ (default)
95+ (finally)
96+ (else)
97+ (goto)
98+ (if)
99+ (switch)
100+ (try)
101+] @keyword.control
102+
103+(return) @keyword.control.return
104+
105+(import) @keyword.control.import
106+
107+[
108+ (for)
109+ (foreach)
110+ (foreach_reverse)
111+ (while)
112+] @keyword.control.repeat
113+
114+[
115+ (not_in)
116+ (not_is)
117+ "/="
118+ "/"
119+ ".."
120+ "..."
121+ "&"
122+ "&="
123+ "&&"
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+] @operator
162+
163+[
164+ "("
165+ ")"
166+ "["
167+ "]"
168+] @punctuation.bracket
169+
170+[
171+ ";"
172+ "."
173+ ":"
174+ ","
175+] @punctuation.delimiter
176+
177+[
178+ (true)
179+ (false)
180+] @constant.builtin.boolean
181+
182+(null) @constant.builtin
183+
184+(special_keyword) @constant.builtin
185+
186+(directive) @keyword.directive
187+(shebang) @keyword.directive
188+
189+(comment) @comment
190+
191+[
192+ (void)
193+ (bool)
194+ (byte)
195+ (ubyte)
196+ (char)
197+ (short)
198+ (ushort)
199+ (wchar)
200+ (dchar)
201+ (int)
202+ (uint)
203+ (long)
204+ (ulong)
205+ (real)
206+ (double)
207+] @type.builtin
208+
209+[
210+ (cent)
211+ (ucent)
212+ (ireal)
213+ (idouble)
214+ (ifloat)
215+ (creal)
216+ (double)
217+ (cfloat)
218+] @warning ; these types are deprecated
219+
220+(label (identifier) @label)
221+(goto_statement (goto) @keyword (identifier) @label)
222+
223+(string_literal) @string
224+(int_literal) @constant.numeric.integer
225+(float_literal) @constant.numeric.float
226+(char_literal) @constant.character
227+(identifier) @variable
228+(at_attribute) @attribute
229+
230+; everything after __EOF_ is plain text
231+(end_file) @ui.text