1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE language SYSTEM "language.dtd">
4
========================================================================
6
D.XML supports syntax highlighting for the D programming language under Kate.
8
Updated 2007-2008 - Diggory Hardy <diggory.hardy@gmail.com> (copyright kate project).
9
Copyright (C) 2007 - Aziz Köksal <aziz.koeksal@gmail.com>
10
Copyright (C) 2007 - Jari-Matti Mäkelä <jmjm@iki.fi>
11
Copyright (C) 2004 - Simon J Mackenzie <project.katedxml@smackoz.fastmail.fm>
13
This code is released under the LGPL as part of kdelibs/kate.
15
========================================================================
17
D is a next generation language written by Walter Bright of Digital Mars fame.
18
Digital Mars C, C++ and D Compilers can be obtained from http://www.digitalmars.com/d/
20
========================================================================
23
2008.09.22 - d.xml 1.61 - D 1.035/2.019 - Fix for identifiers starting _ and containing numbers.
24
2008.08.01 - d.xml 1.60 - D 1.033/2.017 - Merging ddoc.xml 1.14 since there is no advantage to having it separate.
25
2008.07.14 - uncommited - Added properties: .tupleof, .offsetof
26
2008.06.14 - D.XML 1.53 - D 1.030/2.014 - Added user keyword highlighting.
27
2008.06.06 - D.XML 1.53 - D 1.030/2.014 - Small fix involving floats starting . in embedded Ddoc.
28
- Added nothrow and pure attributes (D2.0 only).
29
2008.04.09 - D.XML 1.52 - D 1.028/2.012 - Added properties (especially for arrays).
30
- Added rules for C-Style indenter (thanks vektorboson!)
31
2008.02.22 - D.XML 1.51 - D 1.027/2.011 - Changed char rule behaviour on line end.
32
- Added support for strings ending with c, w or d (must have got lost at some point).
33
2008.02.22 - ddoc.xml 1.14 - Fixes/improvements for macros. Highlights first symbol and non-symbols
34
before as errors; matches embedded brackets () properly.
35
2008.01.09 - D.XML 1.50 - D 1.025/2.009 - Changed pragma, version, deprecated matching to use keyword not DetectString.
36
2007.12.18 - D.XML 1.49 - D 1.025/2.009 - Fixed some bugs to make the StartingLetter context exit correctly and match identifiers properly.
37
2007.12.12 - D.XML 1.48 - D 1.024/2.008 - Adjusted existing contexts somewhat (mostly cleanup).
38
- Implemented scope context to hightlight exit in scope(exit) etc.
39
- Adjusted deprecated keyword highlighting.
40
- Changed layout somewhat.
41
- Implemented extra highlighting rules for expressions, attributes, etc.
42
- Changed a lot of colours.
43
2007.11.15 - D.XML 1.47 - D 1.023/2.007 - Fixed a few unapperent "bugs" found by checkdtd.
44
2007.11.15 - ddoc.xml 1.13 - Fixed a couple of bugs found by checkdtd and changed the version number format.
45
2007.11.5 - ddoc.xml 1.12 - Fixed: correct matching of things like /***/ .
46
2007.10.11 - ddoc.xml 1.11 - Safety catch: check for unterminated code sections (i.e. check for end of
47
ddoc comment even in code sections).
48
- Used DetectIdentifier to (presumably) improve performance.
49
2007.10.09 - uncommited - ditto - Changed some context="#pop" tags to context="#stay" within the normal
50
context (bugfix for ddoc embedded code highlighting).
51
2007.10.9 - ddoc.xml 1.10 - Enabled embedded ddoc code highlighting
52
2007.10.9 - ddoc.xml 1.00 - Initial version
53
2007.10.08 - D.XML 1.46 - D 1.022/2.005 - Stole Alert and Region Marker highlighting from C++ syntax.
54
- Added support for DDoc highlighting.
55
- Reviewed the float regexps again! Tried to make the best of both versions.
56
2007.09.17 - D.XML 1.45 - D 1.021/2.004 - Reverted back to old regexps (but fixed hex floats).
57
Can't combine all float regexps into a single RegExpr element using the '|' operator.
58
It creates strange problems (like program lock-ups and wrong matches).
59
- Fix: '=' is allowed in import statements now.
60
- Fix: character literals are matched correctly now.
61
- The #line special token sequence is matched fully now (the filespec string needs special handling).
62
2007.09.10 - D.XML 1.44 - D 1.021/2.004 - Added __EOF__ to specialtokens.
63
- Replaced float regexps with more accurate ones. Not sure about speed.
64
- Fixed Octal regexp not to match 0_ .
65
2007.07.24 - D.XML 1.43 - D 1.020/2.003 - Added System to ltypes.
66
- Improved matching of version declarations.
67
- Fixed matching of hexadecimal floats.
68
- Deprecated style is stroked out again.
69
2007.07.21 - D.XML 1.42 - D 1.018/2.002 - d.xml validates again according to language.xml.
70
- HTML entities are highlighted now.
71
- Numbers before and after the slice operator are not highl. as floats anymore.
72
- Added C++ to ltypes.
73
- Improved matching of module/import declarations.
74
2007.07.01 - D.XML 1.41 - D 1.017/2.001 - fixed matching of numbers, added deprecated style, minor changes to styles, updated authors line
75
2007.07.01 - D.XML 1.40 - D 1.017/2.001 - matches now .di extensions, removed phobos-specific printf/writef and added
76
- library defined symbols string, wstring, dstring, size_t, ptrdiff_t, hash_t,
77
- Error, Exception, Object, TypeInfo and ClassInfo
78
2007.06.30 - D.XML 1.39 - D 1.017 - matching is much faster now, added "lib" to pragma types, added special tokens,
79
- /+ +/ can be nested now, numbers are matched more correctly, character literals don't span multiple lines anymore
80
- escape sequences inside strings and character literals are highlighted,
81
- non-hex characters in hex strings are highlighted with the Error style,
82
- using more default styles instead of custom ones
83
2007.04.11 - D.XML 1.38 - D 1.011 - ref, macro keywords are now supported, fixed \\ inside a string, updated author
84
2007.02.12 - D.XML 1.37 - D 1.006 - bool, foreach_reverse, lazy, scope and typeid keywords are now supported, fixed \"
85
- inside a string, fixed ending of wysiwyg strings.
86
2004.08.15 - D.XML 1.36 - D 0.98 - Current release of D.
87
- package, writef(strictly speaking writef isn't a keyword) - keywords are now supported.
88
2004.??.?? - D.XML 1.35 - D 0.?? - Not sure how this release got posted!
89
2004.05.23 - D.XML 1.34 - D 0.90 - updated.
90
2004.05.19 - D.XML 1.33 - D 0.89 - mixin - keyword is now supported.
91
2004.05.19 - D.XML 1.32 - D 0.77 - pragma, typeof - keywords are now supported.
92
2004.05.19 - D.XML 1.31 - D 0.76 - is - keyword is now supported.
93
2003.09.06 - D.XML 1.30 - D 0.71 - foreach - keyword is now supported.
94
2003.08.18 - D.XML 1.20 - D 0.69 - floats are now supported.
95
- embedded underscores in integer and float literals are now supported.
96
2003.08.11 - D.XML 1.10 - updated.
97
2003.07.18 - D.XML 1.00 - First released.
99
TODO:- Deliminated strings and Token strings (D2.0) are not supported.
101
========================================================================
104
<language name="D" version="1.62" kateversion="2.5" section="Sources" extensions="*.d;*.D;*.di;*.DI;" mimetype="text/x-dsrc" casesensitive="true" author="Diggory Hardy (diggory.hardy@gmail.com), Aziz Köksal (aziz.koeksal@gmail.com), Jari-Matti Mäkelä (jmjm@iki.fi), Simon J Mackenzie (project.katedxml@smackoz.fastmail.fm)" license="LGPL">
106
<!-- User-defined keywords (add identifiers you'd like highlighted here) -->
107
<list name="userkeywords">
109
<list name="statements">
115
<item> continue </item>
116
<item> default </item>
119
<item> finally </item>
121
<item> foreach </item>
122
<item> foreach_reverse </item>
126
<item> return </item>
127
<item> switch </item>
133
<!-- these are statements according to the spec, although I might call them attributes -->
134
<item> synchronized </item>
138
<list name="attributes">
139
<!-- also storage classes -->
140
<item> abstract </item>
144
<item> export </item>
146
<item> immutable </item>
148
<item> invariant </item>
150
<item> nothrow </item>
151
<item> override </item>
152
<item> package </item>
153
<item> private </item>
154
<item> protected </item>
155
<item> public </item>
158
<item> static </item>
160
<!-- these may be statements -->
161
<!-- in (more common to use as an expression since in attribute is only ever the default) -->
166
<list name="expressions">
167
<!-- primary expressions -->
173
<item> typeid </item>
175
<!-- other expressions -->
176
<item> assert </item>
180
<item> delete </item>
181
<item> in </item> <!-- also an attribute and a statement -->
183
<!-- sometimes declarators -->
184
<item> delegate </item>
185
<item> function </item>
188
<list name="modules">
189
<item> module </item>
190
<item> import </item> <!-- also an expression -->
193
<list name="declarators">
196
<item> typedef </item>
198
<item> interface </item>
199
<item> struct </item>
204
<item> typeof </item>
211
<item> ushort </item>
219
<item> double </item>
222
<item> ifloat </item>
223
<item> idouble </item>
225
<item> cfloat </item>
226
<item> cdouble </item>
232
<list name="templates">
233
<item> macro </item> <!-- what's this? just reserved? -->
234
<item> template </item>
237
<list name="properties">
239
<item> sizeof </item>
240
<item> alignof </item>
241
<item> mangleof </item>
242
<item> stringof </item>
243
<item> tupleof </item>
244
<item> offsetof </item>
247
<item> infinity </item>
250
<item> epsilon </item>
251
<item> mant_dig </item>
252
<item> max_10_exp </item>
253
<item> max_exp </item>
254
<item> min_10_exp </item>
255
<item> min_exp </item>
258
<item> length </item>
262
<item> reverse </item>
265
<item> values </item>
266
<item> rehash </item>
269
<list name="libsymbols">
270
<!-- these are only symbols defined in object.d(i) -->
271
<item> size_t </item>
272
<item> ptrdiff_t </item>
273
<item> hash_t </item>
275
<item> Exception </item>
276
<item> Object </item>
277
<item> TypeInfo </item>
278
<item> ClassInfo </item>
279
<item> ModuleInfo </item>
280
<item> Interface </item>
281
<item> OffsetTypeInfo </item>
282
<item> TypeInfo_Typedef </item>
283
<item> TypeInfo_Enum </item>
284
<item> TypeInfo_Pointer </item>
285
<item> TypeInfo_Array </item>
286
<item> TypeInfo_StaticArray </item>
287
<item> TypeInfo_AssociativeArray </item>
288
<item> TypeInfo_Function </item>
289
<item> TypeInfo_Delegate </item>
290
<item> TypeInfo_Class </item>
291
<item> TypeInfo_Interface </item>
292
<item> TypeInfo_Struct </item>
293
<item> TypeInfo_Tuple </item>
295
<!-- phobos only as of tango 0.99.3 -->
296
<item> string </item>
297
<item> wstring </item>
298
<item> dstring </item>
300
<item> TypeInfo_Const </item>
301
<item> TypeInfo_Invariant </item>
304
<list name="linkage">
305
<item> extern </item>
309
<!-- <item> C++ </item> --><!-- is handled specially in Linkage rule -->
311
<item> Windows </item>
312
<item> Pascal </item>
313
<item> System </item>
321
<list name="scope_keywords">
323
<item> success </item>
324
<item> failure </item>
328
<item> DigitalMars </item>
330
<item> X86_64 </item>
331
<item> Windows </item>
335
<item> LittleEndian </item>
336
<item> BigEndian </item>
337
<item> D_Coverage </item>
338
<item> D_InlineAsm_X86 </item>
339
<item> unittest </item>
340
<item> D_Version2 </item>
345
<list name="specialtokens">
346
<item> __FILE__ </item>
347
<item> __LINE__ </item>
348
<item> __DATE__ </item>
349
<item> __TIME__ </item>
350
<item> __TIMESTAMP__ </item>
351
<item> __VENDOR__ </item>
352
<item> __VERSION__ </item>
353
<item> __EOF__ </item>
358
<item> unittest </item>
362
<item> pragma </item>
365
<list name="version">
366
<item> version </item>
369
<list name="deprecated">
370
<item> deprecated </item>
371
<item> volatile </item> <!-- has been deprecated -->
375
<context name="normal" attribute="Normal Text" lineEndContext="#stay">
377
<!-- Performance improvement (probably): anything starting with a letter is matched separately -->
378
<RegExpr String="[a-zA-Z_]" attribute="Normal Text" context="StartingLetter" lookAhead="true"/>
380
<HlCStringChar attribute="EscapeSequence" context="#stay"/>
381
<Detect2Chars attribute="EscapeSequence" context="UnicodeShort" char="\" char1="u"/>
382
<Detect2Chars attribute="EscapeSequence" context="UnicodeLong" char="\" char1="U"/>
383
<Detect2Chars attribute="EscapeSequence" context="HTMLEntity" char="\" char1="&"/>
385
<DetectChar attribute="Char" context="CharLiteral" char="'"/>
386
<DetectChar attribute="String" context="String" char="""/>
387
<DetectChar attribute="BQString" context="BQString" char="`"/>
389
<StringDetect attribute="Region Marker" context="Region Marker" String="//BEGIN" beginRegion="Region1" firstNonSpace="true" />
390
<StringDetect attribute="Region Marker" context="Region Marker" String="//END" endRegion="Region1" firstNonSpace="true" />
391
<IncludeRules context="CommentRules" />
393
<!-- Match ... and .. before numbers are matched. -->
394
<!-- Now in symbols keywords section -->
395
<StringDetect attribute="Normal Text" context="#stay" String="..."/>
396
<Detect2Chars attribute="Normal Text" char="." char1="."/>
398
<!-- Float starting with a dot -->
399
<RegExpr attribute="Float" context="#stay" String="\.\d[\d_]*([eE][-+]?\d[\d_]*)?[fFL]?i?"/>
401
<!-- Try to match various built-in properties -->
402
<DetectChar char="." attribute="Normal Text" context="Properties"/>
404
<!-- Look ahead for a digit and switch to NumberLiteral context if found. -->
405
<RegExpr context="NumberLiteral" String="\d" attribute="" lookAhead="true"/>
407
<!-- #line Integer [Filespec] -->
408
<StringDetect attribute="Pragma" context="LinePragma" String="#line"/>
410
<!-- Rules for the C-style indenter. Currently problems with /// and /++ comments. -->
411
<DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="BraceA" />
412
<DetectChar attribute="Symbol" context="#stay" char="}" endRegion="BraceA" />
413
<AnyChar attribute="Symbol" context="#stay" String=":!%&()+,-/.*<=>?[]|~^;"/>
416
<context name="StartingLetter" attribute="Normal Text" lineEndContext="#pop">
418
<!-- fall-through should work now that DetectIdentifier is used (without infinite loops) -->
419
<!-- maybe not... got an infinite loop -->
420
<RegExpr String="[^a-zA-Z_]" attribute="Normal Text" context="#pop" lookAhead="true"/>
422
<!-- detect whether scope, in, out, etc. are used as attributes or statements (etc.) -->
423
<!-- rules cannot match across newlines unfortunately -->
424
<RegExpr String="in\s*(?=\{)" attribute="Statement" context="#stay" />
425
<RegExpr String="out\s*(?=(\(([a-zA-Z_][\w_]*)?\)\s*)?\{)" attribute="Statement" context="#stay" />
426
<RegExpr String="scope\s*(?=\()" attribute="Statement" context="Scope" />
427
<RegExpr String="import\s*(?=\()" attribute="Expression" context="#stay" />
428
<RegExpr String="function\s*(?=\()" attribute="Declarator" context="#stay" />
429
<RegExpr String="delegate\s*(?=\()" attribute="Declarator" context="#stay" />
431
<keyword String="statements" attribute="Statement" context="#stay" />
432
<keyword String="attributes" attribute="Attribute" context="#stay" />
433
<keyword String="expressions" attribute="Expression" context="#stay" />
434
<keyword String="declarators" attribute="Declarator" context="#stay" />
435
<keyword String="templates" attribute="Template" context="#stay" />
436
<keyword String="modules" attribute="Module" context="ModuleName"/>
437
<keyword String="types" attribute="Type" context="#stay" />
438
<keyword String="libsymbols" attribute="LibrarySymbols" context="#stay" />
439
<keyword String="linkage" attribute="Linkage" context="Linkage" />
440
<keyword String="specialtokens" attribute="SpecialTokens" context="#stay" />
441
<keyword String="tests" attribute="Tests" context="#stay" />
442
<!-- These must use keyword not DetectString: DetectString does not check for word-break after string. -->
443
<keyword String="pragma" attribute="Pragma" context="Pragma" />
444
<keyword String="version" attribute="Version" context="Version" />
445
<keyword String="deprecated" attribute="Deprecated" context="#stay" />
447
<Detect2Chars attribute="RawString" context="RawString" char="r" char1="""/>
448
<Detect2Chars attribute="HexString" context="HexString" char="x" char1="""/>
450
<!-- user highlighting: last so as not to interfere with anything else -->
451
<keyword String="userkeywords" attribute="UserKeywords" context="#stay" />
456
<context name="Properties" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
457
<keyword String="properties" attribute="Property" context="#pop" />
459
<context name="NumberLiteral" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
460
<!-- Float literals -->
461
<!-- Floats must be matched before Binary|Octal|Hex|DecInteger -->
462
<RegExpr attribute="Float" context="#pop" String="0[xX][\da-fA-F_]*(\.[\da-fA-F_]*)?[pP][-+]?\d[\d_]*[fFL]?i?"/>
463
<!-- Float starting with a dot is matched in main context -->
464
<!-- All floats except integers -->
465
<!-- RegExpr is branched rather than using look aheads for efficiency at the expense of extra length -->
466
<RegExpr attribute="Float" context="#pop" String="\d[_\d]*(\.(?!\.)[_\d]*([eE][-+]?\d[_\d]*)?[fFL]?i?|[eE][-+]?\d[_\d]*[fFL]?i?|[fF]i?|[fFL]?i)"/>
468
<!-- Binary|Octal|Hex|DecInteger -->
469
<!-- Common, optional suffix: (L[uU]?|[uU]L?)? -->
470
<RegExpr attribute="Binary" context="#pop" String="0[bB]_*[01][01_]*(L[uU]?|[uU]L?)?"/>
471
<!-- Octal must be matched before DecInteger -->
472
<RegExpr attribute="Octal" context="#pop" String="0[0-7_]+(L[uU]?|[uU]L?)?"/>
473
<RegExpr attribute="Hex" context="#pop" String="0[xX]_*[\da-fA-F][\da-fA-F_]*(L[uU]?|[uU]L?)?"/>
474
<!-- Decimal integers must be matched last -->
475
<RegExpr attribute="Integer" context="#pop" String="\d+[\d_]*(L[uU]?|[uU]L?)?"/>
478
<context name="LinePragma" attribute="Pragma" lineEndContext="#pop">
480
<!-- Match an Integer -->
481
<RegExpr attribute="Integer" context="#stay" String="((0([0-7_]+|[bB]_*[01][01_]*|[xX]_*[\da-fA-F][\da-fA-F_]*))|\d+[\d_]*)(L[uU]?|[uU]L?)?"/>
482
<RegExpr attribute="String" context="#stay" String=""[^"]*""/>
483
<keyword attribute="SpecialTokens" context="#stay" String="specialtokens"/>
484
<IncludeRules context="CommentRules" />
485
<RegExpr attribute="Error" context="#pop" String=".+"/>
488
<!-- \u 4HexDigits -->
489
<context name="UnicodeShort" attribute="EscapeSequence" lineEndContext="#pop">
490
<RegExpr attribute="EscapeSequence" context="#pop" String="[\da-fA-F]{4}"/>
492
<!-- \U 8HexDigits -->
493
<context name="UnicodeLong" attribute="EscapeSequence" lineEndContext="#pop">
494
<RegExpr attribute="EscapeSequence" context="#pop" String="[\da-fA-F]{8}"/>
496
<!-- \& Alpha Alphanumerical+ ; -->
497
<context name="HTMLEntity" attribute="EscapeSequence" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
498
<RegExpr attribute="EscapeSequence" context="#pop" String="[a-zA-Z]\w+;"/>
501
<context name="ModuleName" attribute="Module Name" lineEndContext="#stay">
503
<IncludeRules context="CommentRules" />
504
<RegExpr context="#pop" String="[^\s\w.:,=]" lookAhead="true"/>
507
<context name="Linkage" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
509
<DetectChar attribute="Normal Text" context="Linkage2" char="("/>
510
<IncludeRules context="CommentRules" />
512
<context name="Linkage2" attribute="Normal Text" lineEndContext="#stay">
514
<StringDetect attribute="Linkage Type" context="#pop#pop" String="C++"/>
515
<keyword attribute="Linkage Type" context="#pop#pop" String="ltypes"/>
516
<IncludeRules context="CommentRules" />
517
<!-- Fall-through rules, highlighting errors: -->
518
<DetectChar char=")" attribute="Normal Text" context="#pop#pop"/>
519
<RegExpr String="[^)\s\n]+" attribute="Error" context="#pop#pop"/>
522
<context name="Version" attribute="Normal Text" lineEndContext="#stay">
524
<DetectChar attribute="Normal Text" context="Version2" char="="/>
525
<DetectChar attribute="Normal Text" context="Version2" char="("/>
526
<IncludeRules context="CommentRules" />
527
<!-- Fall-through rules, highlighting errors: -->
528
<RegExpr String="[^\s\n]+" attribute="Error" context="#pop"/>
530
<context name="Version2" attribute="Normal Text" lineEndContext="#stay">
532
<keyword attribute="Version Type" context="#pop#pop" String="vtypes"/>
533
<DetectIdentifier attribute="Normal Text" context="#pop#pop"/>
534
<RegExpr attribute="Integer" context="#pop#pop" String="\d+[\d_]*(L[uU]?|[uU]L?)?"/>
535
<IncludeRules context="CommentRules" />
536
<!-- Fall-through rules, highlighting errors: -->
537
<DetectChar char=")" attribute="Normal Text" context="#pop#pop"/>
538
<RegExpr String="[^)\s\n]+" attribute="Error" context="#pop#pop"/>
541
<context name="Scope" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
543
<DetectChar attribute="Normal Text" context="Scope2" char="("/>
544
<IncludeRules context="CommentRules" />
546
<context name="Scope2" attribute="Normal Text" lineEndContext="#stay">
548
<keyword String="scope_keywords" attribute="Expression" context="#pop#pop"/>
549
<IncludeRules context="CommentRules" />
550
<!-- Fall-through rules, highlighting errors: -->
551
<DetectChar char=")" attribute="Normal Text" context="#pop#pop"/>
552
<RegExpr String="[^)\s\n]+" attribute="Error" context="#pop#pop"/>
555
<context name="Pragma" attribute="Pragma" lineEndContext="#stay">
557
<DetectChar attribute="Normal Text" context="Pragma2" char="("/>
558
<IncludeRules context="CommentRules" />
559
<!-- Fall-through rules, highlighting errors: -->
560
<RegExpr String="[^\s\n]+" attribute="Error" context="#pop"/>
562
<context name="Pragma2" attribute="Pragma" lineEndContext="#stay">
564
<keyword attribute="Version Type" context="#pop#pop" String="ptypes"/>
565
<DetectIdentifier attribute="Normal Text" context="#pop#pop"/>
566
<IncludeRules context="CommentRules" />
567
<!-- Fall-through rules, highlighting errors: -->
568
<DetectChar char=")" attribute="Normal Text" context="#pop#pop"/>
569
<RegExpr String="[^)\s\n]+" attribute="Error" context="#pop#pop"/>
574
<context name="RawString" attribute="RawString" lineEndContext="#stay">
575
<DetectChar attribute="RawString" context="#pop" char="""/>
578
<context name="BQString" attribute="BQString" lineEndContext="#stay">
579
<DetectChar attribute="BQString" context="#pop" char="`"/>
582
<context name="HexString" attribute="HexString" lineEndContext="#stay">
583
<DetectChar attribute="HexString" context="#pop" char="""/>
584
<RegExpr attribute="Error" context="#stay" String="[^\sa-fA-F\d"]+" />
587
<context name="CharLiteral" attribute="Char" lineEndContext="CharLiteralClosing" fallthrough="true" fallthroughContext="#pop">
589
<DetectChar attribute="Char" context="#pop" char="'"/>
590
<!-- \t \n \r etc. -->
591
<HlCStringChar attribute="EscapeSequence" context="CharLiteralClosing"/>
592
<!-- \u 4HexDigits | \U 8HexDigits | HTMLEntity -->
593
<RegExpr attribute="EscapeSequence" context="CharLiteralClosing" String="\\(u[\da-fA-F]{4}|U[\da-fA-F]{8}|&[a-zA-Z]\w+;)"/>
594
<!-- Invalid escape sequences -->
595
<RegExpr attribute="Error" context="CharLiteralClosing" String="\\."/>
596
<!-- Any character -->
597
<RegExpr attribute="Char" context="CharLiteralClosing" String="."/>
599
<!-- Anything other than a closing ' is now be an error -->
600
<context name="CharLiteralClosing" attribute="Error" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
601
<DetectChar attribute="Char" context="#pop#pop" char="'"/>
604
<context name="String" attribute="String" lineEndContext="#stay">
605
<HlCStringChar attribute="EscapeSequence"/>
606
<Detect2Chars attribute="String" context="#pop" char=""" char1="c"/>
607
<Detect2Chars attribute="String" context="#pop" char=""" char1="w"/>
608
<Detect2Chars attribute="String" context="#pop" char=""" char1="d"/>
609
<DetectChar attribute="String" context="#pop" char="""/>
610
<Detect2Chars attribute="EscapeSequence" context="UnicodeShort" char="\" char1="u"/>
611
<Detect2Chars attribute="EscapeSequence" context="UnicodeLong" char="\" char1="U"/>
612
<Detect2Chars attribute="EscapeSequence" context="HTMLEntity" char="\" char1="&"/>
616
<context name="CommentRules" attribute="Normal Text" lineEndContext="#pop">
617
<IncludeRules context="DdocNormal" />
618
<Detect2Chars attribute="Comment" context="CommentLine" char="/" char1="/"/>
619
<Detect2Chars attribute="Comment" context="CommentBlock" char="/" char1="*" beginRegion="CommentBlock"/>
620
<Detect2Chars attribute="Comment" context="CommentNested" char="/" char1="+" beginRegion="CommentNested"/>
621
<!-- This context is only for including rules from. -->
623
<context name="Region Marker" attribute="Region Marker" lineEndContext="#pop">
625
<context name="CommentLine" attribute="Comment" lineEndContext="#pop">
627
<IncludeRules context="##Alerts" />
629
<context name="CommentBlock" attribute="Comment" lineEndContext="#stay">
631
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="CommentBlock"/>
632
<IncludeRules context="##Alerts" />
634
<context name="CommentNested" attribute="Comment" lineEndContext="#stay">
636
<Detect2Chars attribute="Comment" context="CommentNested" char="/" char1="+" beginRegion="CommentNested"/>
637
<Detect2Chars attribute="Comment" context="#pop" char="+" char1="/" endRegion="CommentNested"/>
638
<IncludeRules context="##Alerts" />
642
<!-- Ddoc contexts -->
643
<context name="DdocNormal" attribute="Normal Text" lineEndContext="#stay">
644
<RegExpr attribute="Comment" context="DdocLine" String="/{3,}"/>
645
<RegExpr attribute="Comment" context="DdocBlock" String="/\*{2,}(?!/)" beginRegion="DdocBlock"/>
646
<RegExpr attribute="Comment" context="DdocNested" String="/\+{2,}(?!/)" beginRegion="DdocNested"/>
649
<context name="DdocLine" attribute="Ddoc" lineEndContext="#pop">
651
<DetectIdentifier attribute="Ddoc"/>
652
<Detect2Chars attribute="Macros" context="DdocMacro" char="$" char1="(" />
653
<RegExpr attribute="DdocSection" context="#stay" String="[\w_]+:($|\s)" />
654
<IncludeRules context="##Alerts" />
657
<context name="DdocBlock" attribute="Ddoc" lineEndContext="#stay">
659
<DetectIdentifier attribute="Ddoc"/>
660
<RegExpr attribute="Comment" context="#pop" String="\*+/" endRegion="DdocBlock"/>
661
<DetectChar attribute="Comment" context="#stay" char="*" firstNonSpace="true" />
663
<Detect2Chars attribute="Macros" context="DdocMacro" char="$" char1="(" />
664
<RegExpr attribute="DdocSection" context="#stay" String="[\w_]+:($|\s)" />
665
<IncludeRules context="##Alerts" />
667
<!-- Avoid matching this; do it this way since (^|\s)-* always matches .- and \s-* never
668
matches .- (spaces have already been matched); however -*($|\s) matches just fine.
669
Also can't use \b since - is not a word character. -->
670
<RegExpr attribute="Ddoc" context="#stay" String="[^-]-{3,}" />
671
<RegExpr attribute="Comment" context="DdocBlockCode" String="-{3,}($|\s)" />
674
<context name="DdocNested" attribute="Ddoc" lineEndContext="#stay">
676
<DetectIdentifier attribute="Ddoc"/>
677
<!-- Ddoc recognises nested comments/ddoc, but ignores them as far as formatting is concerned. -->
678
<Detect2Chars attribute="Ddoc" context="DdocNested2" char="/" char1="+"/>
679
<RegExpr attribute="Comment" context="#pop" String="\++/" endRegion="DdocNested"/>
680
<DetectChar attribute="Comment" context="#stay" char="+" firstNonSpace="true" />
682
<Detect2Chars attribute="Macros" context="DdocMacro" char="$" char1="(" />
683
<RegExpr attribute="DdocSection" context="#stay" String="[\w_]+:($|\s)" />
684
<IncludeRules context="##Alerts" />
687
<RegExpr attribute="Ddoc" context="#stay" String="[^-]-{3,}" />
688
<RegExpr attribute="Comment" context="DdocNestedCode" String="-{3,}($|\s)" />
691
<context name="DdocNested2" attribute="Ddoc" lineEndContext="#stay">
693
<DetectIdentifier attribute="Ddoc"/>
694
<!-- Identical to DdocNested except that nested comments don't receive any formatting -->
695
<RegExpr attribute="Ddoc" context="#pop" String="\++/"/>
696
<!-- The above rules should match before the unwanted rule in DdocNested -->
697
<IncludeRules context="DdocNested" />
700
<!-- When entering a macro: provides highlighting for first symbol (macro name) -->
701
<context name="DdocMacro" attribute="Error" lineEndContext="#stay">
702
<DetectSpaces attribute="Macro Text" /> <!-- avoid showing space as an error -->
704
<DetectChar attribute="Macros" context="#pop" char=")" /> <!-- early end of macro -->
705
<IncludeRules context="MacroRules" />
707
<!-- first symbol of macro -->
708
<DetectIdentifier attribute="Macros" context="DdocMacro2" />
710
<!-- For rest of macro -->
711
<context name="DdocMacro2" attribute="Macro Text" lineEndContext="#stay">
712
<DetectChar attribute="Macros" context="#pop#pop" char=")" /> <!-- end of macro -->
713
<IncludeRules context="MacroRules" />
715
<!-- For embedded brackets (yeah, extra work to ignore them) -->
716
<context name="DdocMacro3" attribute="Macro Text" lineEndContext="#stay">
717
<DetectChar attribute="Macro Text" context="#pop" char=")" /> <!-- end of embedded brackets -->
718
<IncludeRules context="MacroRules" />
720
<!-- Rules common to all macros -->
721
<context name="MacroRules" attribute="Macro Text" lineEndContext="#stay">
722
<Detect2Chars attribute="Macros" context="DdocMacro" char="$" char1="(" /> <!-- embedded -->
723
<DetectChar attribute="Macro Text" context="DdocMacro3" char="(" /> <!-- extra brackets -->
725
<DetectChar attribute="Comment" context="#stay" char="*" firstNonSpace="true" />
728
<context name="DdocBlockCode" attribute="DdocCode" lineEndContext="#stay">
730
<!-- See update 1.11 -->
731
<RegExpr attribute="Comment" context="#pop#pop" String="\*+/" endRegion="DdocBlock"/>
732
<DetectChar attribute="Comment" context="#stay" char="*" firstNonSpace="true" />
734
<RegExpr attribute="DdocCode" context="#stay" String="[^-]-{3,}" />
735
<RegExpr attribute="Comment" context="#pop" String="-{3,}($|\s)" />
736
<IncludeRules context="##D" />
738
<context name="DdocNestedCode" attribute="DdocCode" lineEndContext="#stay">
740
<!-- See update 1.11 -->
741
<RegExpr attribute="Comment" context="#pop#pop" String="\++/" endRegion="DdocNested"/>
742
<DetectChar attribute="Comment" context="#stay" char="+" firstNonSpace="true" />
744
<RegExpr attribute="DdocCode" context="#stay" String="[^-]-{3,}" />
745
<RegExpr attribute="Comment" context="#pop" String="-{3,}($|\s)" />
746
<IncludeRules context="##D" />
750
<itemData name="Normal Text" defStyleNum="dsNormal"/>
751
<itemData name="Symbol" defStyleNum="dsNormal"/>
754
<itemData name="Statement" defStyleNum="dsKeyword"/>
755
<itemData name="Expression" defStyleNum="dsKeyword" color="#000080"/>
756
<itemData name="Declarator" defStyleNum="dsKeyword" color="#800000"/>
757
<itemData name="Template" defStyleNum="dsKeyword" color="#008000"/>
759
<itemData name="Attribute" defStyleNum="dsKeyword" color="#800080"/>
760
<itemData name="Deprecated" defStyleNum="dsKeyword" color="#800080" strikeOut="true"/>
762
<itemData name="Property" defStyleNum="dsDataType" color="#000080"/>
764
<itemData name="Type" defStyleNum="dsDataType"/>
765
<itemData name="LibrarySymbols" defStyleNum="dsDataType" italic="1"/>
767
<itemData name="UserKeywords" defStyleNum="dsDataType" italic="1"/>
769
<!-- module, import -->
770
<itemData name="Module" defStyleNum="dsKeyword" color="#008000"/>
771
<itemData name="Module Name" defStyleNum="dsNormal" color="#008000"/>
773
<!-- pragma, special tokens -->
774
<itemData name="SpecialTokens" defStyleNum="dsNormal" color="#00aa00"/>
775
<itemData name="Pragma" defStyleNum="dsKeyword" color="#00aa00"/>
777
<!-- version, extern -->
778
<itemData name="Version" defStyleNum="dsKeyword" color="#808000"/>
779
<itemData name="Version Type" defStyleNum="dsNormal" bold="1"/>
780
<itemData name="Linkage" defStyleNum="dsKeyword" color="#808000"/>
781
<itemData name="Linkage Type" defStyleNum="dsNormal" bold="1"/>
783
<itemData name="Tests" defStyleNum="dsKeyword" color="#ff00ff"/>
785
<itemData name="Comment" defStyleNum="dsComment"/>
786
<itemData name="Region Marker" defStyleNum="dsRegionMarker" />
788
<itemData name="Error" defStyleNum="dsError"/>
791
<itemData name="Integer" defStyleNum="dsDecVal"/>
792
<itemData name="Binary" defStyleNum="dsBaseN"/>
793
<itemData name="Octal" defStyleNum="dsBaseN"/>
794
<itemData name="Hex" defStyleNum="dsBaseN"/>
795
<itemData name="Float" defStyleNum="dsFloat"/>
797
<itemData name="EscapeSequence" defStyleNum="dsString" color="#00aa88" selColor="#ff0000"/>
798
<itemData name="String" defStyleNum="dsString"/>
799
<itemData name="Char" defStyleNum="dsChar"/>
800
<itemData name="RawString" defStyleNum="dsString" color="#a100a1" selColor="#ff00ff"/>
801
<itemData name="BQString" defStyleNum="dsString" color="#a100a1" selColor="#ff00ff"/>
802
<itemData name="HexString" defStyleNum="dsString" color="#a10022" selColor="#ff0055"/>
804
<!-- Ddoc specific -->
805
<itemData name="Macros" defStyleNum="dsOthers" color="#bf5fbf" selColor="#ffffff" bold="1" italic="0" />
806
<itemData name="Macro Text" defStyleNum="dsNormal" color="#bf7fff" selColor="#ffffff" bold="0" italic="0" />
807
<itemData name="Ddoc" defStyleNum="dsComment" color="#7f7fff" />
808
<itemData name="DdocSection" defStyleNum="dsKeyword" color="#7f7fff" bold="1" />
809
<itemData name="DdocCode" defStyleNum="dsNormal" italic="1" />
814
<comment name="singleLine" start="//"/>
815
<comment name="multiLine" start="/+" end="+/" region="CommentNested"/>
817
<keywords casesensitive="true"/>