summaryrefslogtreecommitdiffstats
path: root/kate/data/rust.xml
blob: 10bf247b024170d378106515f5041739da55aae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (c) 2015 The Rust Project Developers

    Permission is hereby granted, free of charge, to any
    person obtaining a copy of this software and associated
    documentation files (the "Software"), to deal in the
    Software without restriction, including without
    limitation the rights to use, copy, modify, merge,
    publish, distribute, sublicense, and/or sell copies of
    the Software, and to permit persons to whom the Software
    is furnished to do so, subject to the following
    conditions:

    The above copyright notice and this permission notice
    shall be included in all copies or substantial portions
    of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
    ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
    TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
    PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
    SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
    IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE language SYSTEM "language.dtd"
[
	<!-- FIXME: Kate's regex engine has very limited support for
	predefined char classes, so making rustIdent consistent with actual
	Rust identifiers will be a bit difficult -->
	<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
	<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
]>
<language name="Rust" version="1.0" kateversion="2.4" section="Sources" extensions="*.rs" mimetype="text/rust" priority="15">
<highlighting>
	<list name="fn">
		<item> fn </item>
	</list>
	<list name="type">
		<item> type </item>
	</list>
	<list name="reserved">
		<item> abstract </item>
		<item> alignof </item>
		<item> become </item>
		<item> do </item>
		<item> final </item>
		<item> offsetof </item>
		<item> override </item>
		<item> priv </item>
		<item> pure </item>
		<item> sizeof </item>
		<item> typeof </item>
		<item> unsized </item>
		<item> yield </item>
	</list>
	<list name="keywords">
		<item> as </item>
		<item> box </item>
		<item> break </item>
		<item> const </item>
		<item> continue </item>
		<item> crate </item>
		<item> else </item>
		<item> enum </item>
		<item> extern </item>
		<item> for </item>
		<item> if </item>
		<item> impl </item>
		<item> in </item>
		<item> let </item>
		<item> loop </item>
		<item> match </item>
		<item> mod </item>
		<item> move </item>
		<item> mut </item>
		<item> pub </item>
		<item> ref </item>
		<item> return </item>
		<item> static </item>
		<item> struct </item>
		<item> super </item>
		<item> trait </item>
		<item> unsafe </item>
		<item> use </item>
		<item> virtual </item>
		<item> where </item>
		<item> while </item>
	</list>
	<list name="traits">
		<item> AsSlice </item>
		<item> CharExt </item>
		<item> Clone </item>
		<item> Copy </item>
		<item> Debug </item>
		<item> Decodable </item>
		<item> Default </item>
		<item> Display </item>
		<item> DoubleEndedIterator </item>
		<item> Drop </item>
		<item> Encodable </item>
		<item> Eq </item>
		<item> Default </item>
		<item> Extend </item>
		<item> Fn </item>
		<item> FnMut </item>
		<item> FnOnce </item>
		<item> FromPrimitive </item>
		<item> Hash </item>
		<item> Iterator </item>
		<item> IteratorExt </item>
		<item> MutPtrExt </item>
		<item> Ord </item>
		<item> PartialEq </item>
		<item> PartialOrd </item>
		<item> PtrExt </item>
		<item> Rand </item>
		<item> Send </item>
		<item> Sized </item>
		<item> SliceConcatExt </item>
		<item> SliceExt </item>
		<item> Str </item>
		<item> StrExt </item>
		<item> Sync </item>
		<item> ToString </item>
	</list>
	<list name="types">
		<item> bool </item>
		<item> int </item>
		<item> isize </item>
		<item> uint </item>
		<item> usize </item>
		<item> i8 </item>
		<item> i16 </item>
		<item> i32 </item>
		<item> i64 </item>
		<item> u8 </item>
		<item> u16 </item>
		<item> u32 </item>
		<item> u64 </item>
		<item> f32 </item>
		<item> f64 </item>
		<item> float </item>
		<item> char </item>
		<item> str </item>
		<item> Option </item>
		<item> Result </item>
		<item> Self </item>
		<item> Box </item>
		<item> Vec </item>
		<item> String </item>
	</list>
	<list name="ctypes">
		<item> c_float </item>
		<item> c_double </item>
		<item> c_void </item>
		<item> FILE </item>
		<item> fpos_t </item>
		<item> DIR </item>
		<item> dirent </item>
		<item> c_char </item>
		<item> c_schar </item>
		<item> c_uchar </item>
		<item> c_short </item>
		<item> c_ushort </item>
		<item> c_int </item>
		<item> c_uint </item>
		<item> c_long </item>
		<item> c_ulong </item>
		<item> size_t </item>
		<item> ptrdiff_t </item>
		<item> clock_t </item>
		<item> time_t </item>
		<item> c_longlong </item>
		<item> c_ulonglong </item>
		<item> intptr_t </item>
		<item> uintptr_t </item>
		<item> off_t </item>
		<item> dev_t </item>
		<item> ino_t </item>
		<item> pid_t </item>
		<item> mode_t </item>
		<item> ssize_t </item>
	</list>
	<list name="self">
		<item> self </item>
	</list>
	<list name="constants">
		<item> true </item>
		<item> false </item>
		<item> Some </item>
		<item> None </item>
		<item> Ok </item>
		<item> Err </item>
		<item> Success </item>
		<item> Failure </item>
		<item> Cons </item>
		<item> Nil </item>
	</list>
	<list name="cconstants">
		<item> EXIT_FAILURE </item>
		<item> EXIT_SUCCESS </item>
		<item> RAND_MAX </item>
		<item> EOF </item>
		<item> SEEK_SET </item>
		<item> SEEK_CUR </item>
		<item> SEEK_END </item>
		<item> _IOFBF </item>
		<item> _IONBF </item>
		<item> _IOLBF </item>
		<item> BUFSIZ </item>
		<item> FOPEN_MAX </item>
		<item> FILENAME_MAX </item>
		<item> L_tmpnam </item>
		<item> TMP_MAX </item>
		<item> O_RDONLY </item>
		<item> O_WRONLY </item>
		<item> O_RDWR </item>
		<item> O_APPEND </item>
		<item> O_CREAT </item>
		<item> O_EXCL </item>
		<item> O_TRUNC </item>
		<item> S_IFIFO </item>
		<item> S_IFCHR </item>
		<item> S_IFBLK </item>
		<item> S_IFDIR </item>
		<item> S_IFREG </item>
		<item> S_IFMT </item>
		<item> S_IEXEC </item>
		<item> S_IWRITE </item>
		<item> S_IREAD </item>
		<item> S_IRWXU </item>
		<item> S_IXUSR </item>
		<item> S_IWUSR </item>
		<item> S_IRUSR </item>
		<item> F_OK </item>
		<item> R_OK </item>
		<item> W_OK </item>
		<item> X_OK </item>
		<item> STDIN_FILENO </item>
		<item> STDOUT_FILENO </item>
		<item> STDERR_FILENO </item>
	</list>
	<contexts>
		<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
			<DetectSpaces/>
			<keyword String="fn" attribute="Keyword" context="Function"/>
			<keyword String="type" attribute="Keyword" context="Type"/>
			<keyword String="reserved" attribute="Keyword" context="#stay"/>
			<keyword String="keywords" attribute="Keyword" context="#stay"/>
			<keyword String="types" attribute="Type" context="#stay"/>
			<keyword String="traits" attribute="Trait" context="#stay"/>
			<keyword String="ctypes" attribute="CType" context="#stay"/>
			<keyword String="self" attribute="Self" context="#stay"/>
			<keyword String="constants" attribute="Constant" context="#stay"/>
			<keyword String="cconstants" attribute="CConstant" context="#stay"/>
			<Detect2Chars char="/" char1="/" attribute="Comment" context="Commentar 1"/>
			<Detect2Chars char="/" char1="*" attribute="Comment" context="Commentar 2" beginRegion="Comment"/>
			<RegExpr String="0x[0-9a-fA-F_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="0o[0-7_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="0b[0-1_]+&rustIntSuf;" attribute="Number" context="#stay"/>
			<RegExpr String="[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?" attribute="Number" context="#stay"/>
			<RegExpr String="[0-9][0-9_]*&rustIntSuf;" attribute="Number" context="#stay"/>
			<Detect2Chars char="#" char1="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
			<StringDetect String="#![" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
			<RegExpr String="&rustIdent;::" attribute="Scope"/>
			<RegExpr String="&rustIdent;!" attribute="Macro"/>
			<RegExpr String="&apos;&rustIdent;(?!&apos;)" attribute="Lifetime"/>
			<DetectChar char="{" attribute="Symbol" context="#stay" beginRegion="Brace" />
			<DetectChar char="}" attribute="Symbol" context="#stay" endRegion="Brace" />
                        <Detect2Chars char="r" char1="&quot;" attribute="String" context="RawString"/>
                        <StringDetect String="r##&quot;" attribute="String" context="RawHashed2"/>
                        <StringDetect String="r#&quot;" attribute="String" context="RawHashed1"/>
			<DetectChar char="&quot;" attribute="String" context="String"/>
			<DetectChar char="&apos;" attribute="Character" context="Character"/>
			<DetectChar char="[" attribute="Symbol" context="#stay" beginRegion="Bracket" />
			<DetectChar char="]" attribute="Symbol" context="#stay" endRegion="Bracket" />
			<DetectIdentifier/>
		</context>
		<context attribute="Attribute" lineEndContext="#stay" name="Attribute">
			<DetectChar char="]" attribute="Attribute" context="#pop" endRegion="Attribute"/>
			<IncludeRules context="Normal"/>
		</context>
		<context attribute="Definition" lineEndContext="#stay" name="Function">
			<DetectSpaces/>
			<DetectChar char="(" attribute="Normal Text" context="#pop"/>
			<DetectChar char="&lt;" attribute="Normal Text" context="#pop"/>
		</context>
		<context attribute="Definition" lineEndContext="#stay" name="Type">
			<DetectSpaces/>
			<DetectChar char="=" attribute="Normal Text" context="#pop"/>
			<DetectChar char="&lt;" attribute="Normal Text" context="#pop"/>
			<DetectChar char=";" attribute="Normal Text" context="#pop"/>
		</context>
                <!-- Rustc allows strings to extend over multiple lines, and the
                only thing a backshash at end-of-line does is remove the whitespace. -->
                <context attribute="String" lineEndContext="#stay" name="String">
                        <DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
                        <DetectChar attribute="String" context="#pop" char="&quot;"/>
                </context>
		<context attribute="String" lineEndContext="#stay" name="RawString">
			<DetectChar attribute="String" context="#pop" char="&quot;"/>
		</context>
                <!-- These rules are't complete: they won't match r###"abc"### -->
                <context attribute="String" lineEndContext="#stay" name="RawHashed1">
                        <Detect2Chars attribute="String" context="#pop" char="&quot;" char1="#"/>
                </context>
                <context attribute="String" lineEndContext="#stay" name="RawHashed2">
                        <StringDetect attribute="String" context="#pop" String="&quot;##"/>
                </context>
		<context attribute="Character" lineEndContext="#pop" name="Character">
			<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
			<DetectChar attribute="Character" context="#pop" char="&apos;"/>
		</context>
		<context attribute="CharEscape" lineEndContext="#pop" name="CharEscape">
			<AnyChar String="nrt\&apos;&quot;" attribute="CharEscape" context="#pop"/>
			<RegExpr String="x[0-9a-fA-F]{2}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="u\{[0-9a-fA-F]{1,6}\}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="u[0-9a-fA-F]{4}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="U[0-9a-fA-F]{8}" attribute="CharEscape" context="#pop"/>
			<RegExpr String="." attribute="Error" context="#pop"/>
		</context>
		<context attribute="Comment" lineEndContext="#pop" name="Commentar 1"/>
		<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
			<DetectSpaces/>
			<Detect2Chars char="*" char1="/" attribute="Comment" context="#pop" endRegion="Comment"/>
		</context>
	</contexts>
	<itemDatas>
		<itemData name="Normal Text"  defStyleNum="dsNormal"/>
		<itemData name="Keyword"      defStyleNum="dsKeyword" color="#770088" bold="1"/>
		<itemData name="Self"         defStyleNum="dsKeyword" color="#FF0000" bold="1"/>
		<itemData name="Type"         defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
		<itemData name="Trait"        defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
		<itemData name="CType"        defStyleNum="dsNormal" color="#4e9a06"/>
		<itemData name="Constant"     defStyleNum="dsKeyword" color="#116644"/>
		<itemData name="CConstant"    defStyleNum="dsNormal" color="#116644"/>
		<itemData name="Definition"   defStyleNum="dsNormal" color="#0000FF"/>
		<itemData name="Comment"      defStyleNum="dsComment" color="#AA5500"/>
		<itemData name="Scope"        defStyleNum="dsNormal" color="#0055AA"/>
		<itemData name="Number"       defStyleNum="dsDecVal" color="#116644"/>
		<itemData name="String"       defStyleNum="dsString" color="#FF0000"/>
		<itemData name="CharEscape"   defStyleNum="dsChar" color="#FF0000" bold="1"/>
		<itemData name="Character"    defStyleNum="dsChar" color="#FF0000"/>
		<itemData name="Macro"        defStyleNum="dsOthers"/>
		<itemData name="Attribute"    defStyleNum="dsOthers"/>
		<itemData name="Lifetime"     defStyleNum="dsOthers" bold="1"/>
		<itemData name="Error"        defStyleNum="dsError"/>
	</itemDatas>
</highlighting>
<general>
	<comments>
		<comment name="singleLine" start="//" />
		<comment name="multiLine" start="/*" end="*/" region="Comment"/>
	</comments>
	<keywords casesensitive="1" />
</general>
</language>