aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/syntax-highlighting/data/syntax/yaml.xml
blob: 120dbd55f7fe3c1ba4e935542cd61eac0924ca04 (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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language
[
  <!ENTITY null "(?:null|Null|NULL|~)">
  <!ENTITY bool "(?:y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)">

  <!ENTITY int         "(?:0|[\-\+]?[1-9][0-9_]*)">
  <!ENTITY intOther    "[\-\+]?0(?:x_*[0-9a-fA-F][0-9a-fA-F_]*|o?_*[0-7][0-7_]*|b_*[01][01_]*)"> <!-- Hex, Octal, Binary -->
  <!ENTITY intBase60   "[\-\+]?[1-9][0-9_]*(?:\:[0-5]?[0-9])+">
  <!ENTITY allInt      "(?:&intBase60;|&intOther;|&int;)">

  <!ENTITY float       "[\-\+]?(?:[0-9][0-9_]*\.[0-9\._]*|\._*[0-9][0-9\._]*)(?:[eE][\-\+]?[0-9]+)?">
  <!ENTITY floatExp    "[\-\+]?[0-9][0-9_]*[eE][\-\+]?[0-9]+">
  <!ENTITY floatBase60 "[\-\+]?[0-9][0-9_]*(?:\:[0-5]?[0-9])+\.[0-9_]*">
  <!ENTITY inf         "[\-\+]?\.(?:inf|Inf|INF)\b">
  <!ENTITY nan         "\.(?:nan|NaN|NAN)\b">
  <!ENTITY allFloat    "(?:&float;|&floatExp;|&floatBase60;|&inf;|&nan;)">

  <!ENTITY endValue       "(?:\s*$|\s+#)">
  <!ENTITY endValueInline "\s*[:,\[\]\{\}]">
  <!ENTITY space          "[ ]">

  <!-- Key quoted -->
  <!ENTITY keyDQ          "&quot;(?:\\.|[^&quot;])+&quot;\s*">
  <!ENTITY keySQ          "'(?:[^']|'')+'\s*">
  <!-- Literal/folded operator -->
  <!ENTITY literalOp      "[\|&gt;][\-\+]?">
  <!-- Key after "?" or "-", used to detect literal/folded operator -->
  <!ENTITY keyAfterOp     "(?:[^&quot;'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)">

  <!ENTITY dataTypes      "!!\S+">
  <!ENTITY alias          "&amp;\S+">
  <!ENTITY reference      "\*\S+">

  <!ENTITY dpointsHashAttrPreInline1 "[^\s&quot;'#\-,\}\s][^:#,\}]*(?=\:(?:\s|$))">
  <!ENTITY dpointsHashAttrPreInline2 "\-(?:[^\s:#,\}][^:#,\}]*)?(?=\:(?:\s|$))">
  <!ENTITY dpointsHashAttrPreInline3 "&keyDQ;(?=\:(?:\s|$))">
  <!ENTITY dpointsHashAttrPreInline4 "&keySQ;(?=\:(?:\s|$))">

  <!ENTITY dpointsListAttrPreInline1 "[^&quot;'#\-,\]\s][^:#,\]]*(?=\:(?:\s|$))">
  <!ENTITY dpointsListAttrPreInline2 "\-(?:[^\s:#,\]][^:#,\]]*)?(?=\:(?:\s|$))">
  <!ENTITY dpointsListAttrPreInline3 "&keyDQ;(?=\:(?:\s|$))">
  <!ENTITY dpointsListAttrPreInline4 "&keySQ;(?=\:(?:\s|$))">

  <!ENTITY dpointsAttrPre1 "[^&quot;'#\-\s][^:#]*(?=\:(?:\s|$))">
  <!ENTITY dpointsAttrPre2 "\-(?:[^\s:#][^:#]*)?(?=\:(?:\s|$))">
  <!ENTITY dpointsAttrPre3 "&keyDQ;(?=\:(?:\s|$))">
  <!ENTITY dpointsAttrPre4 "&keySQ;(?=\:(?:\s|$))">

]>

<!-- Author: Dr Orlovsky MA <maxim@orlovsky.info> //-->
<!-- Modifications (YAML 1.2), values & support for literal/folded style:
       Nibaldo González S. <nibgonz@gmail.com>
       These modifications are under the MIT license. //-->
<language name="YAML" version="11" kateversion="5.0" section="Markup"
          extensions="*.yaml;*.yml" mimetype="text/yaml" priority="9"
          author="Dr Orlovsky MA (dr.orlovsky@gmail.com), Nibaldo González (nibgonz@gmail.com)" license="LGPL">
  <highlighting>
    <contexts>
      <context attribute="Attribute" lineEndContext="#stay" name="normal" >
        <StringDetect attribute="Document Header" context="header" String="---" column="0"/>
        <RegExpr attribute="End of Document" context="EOD" String="^\.\.\.$" column="0"/>
        <DetectChar attribute="Directive" context="directive" char="%" column="0"/>

        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />

        <!-- Literal/Folded Style -->
        <IncludeRules context="find-literal-block" />

        <RegExpr attribute="Operator" firstNonSpace="true" context="dash" String="\-(?=\s|$)" />
        <DetectChar attribute="Operator" firstNonSpace="true" context="mapping-key" char="?" />

        <DetectChar attribute="Operator" firstNonSpace="true" context="list" char="[" beginRegion="List" />
        <DetectChar attribute="Operator" firstNonSpace="true" context="hash" char="{" beginRegion="Hash" />

        <RegExpr attribute="Data Types" firstNonSpace="true" context="after-data" String="&dataTypes;" />
        <RegExpr attribute="Alias" firstNonSpace="true" context="after-data" String="&alias;" />
        <RegExpr attribute="Reference" firstNonSpace="true" context="after-data" String="&reference;" />

        <RegExpr attribute="Key" context="dpoints-attribute-pre" String="&dpointsAttrPre1;|&dpointsAttrPre2;|&dpointsAttrPre3;|&dpointsAttrPre4;"/>
        <RegExpr attribute="Key Points Operator" context="attribute-pre" String=":(?=\s|$)"/>

        <DetectChar attribute="String" firstNonSpace="true" context="string" char="'" beginRegion="String" />
        <DetectChar attribute="String" firstNonSpace="true" context="stringx" char="&quot;" beginRegion="String" />
        <IncludeRules context="values-firstnonspace" />
        <DetectSpaces/>
      </context>

      <context attribute="Normal Text" lineEndContext="#pop" name="mapping-key" fallthrough="true" fallthroughContext="#pop">
        <RegExpr attribute="Comment" context="#pop!comment" String="(?:^|\s+)#" />
        <DetectSpaces />
        <RegExpr attribute="Operator" context="#pop!dash" String="\-(?=\s|$)" />
        <RegExpr attribute="Data Types" context="#pop!after-data" String="&dataTypes;" />
        <RegExpr attribute="Alias" context="#pop!after-data" String="&alias;" />
        <RegExpr attribute="Reference" context="#pop!after-data" String="&reference;" />

        <DetectChar attribute="Operator" context="#pop!list" char="[" beginRegion="List" />
        <DetectChar attribute="Operator" context="#pop!hash" char="{" beginRegion="Hash" />
        <DetectChar attribute="String" context="#pop!string" char="'" beginRegion="String" />
        <DetectChar attribute="String" context="#pop!stringx" char="&quot;" beginRegion="String" />
      </context>

      <context attribute="Normal Text" lineEndContext="#pop" name="dash" fallthrough="true" fallthroughContext="#pop">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
        <DetectSpaces/>
        <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
        <RegExpr attribute="Alias" context="#stay" String="&alias;" />
        <RegExpr attribute="Reference" context="#stay" String="&reference;" />
        <IncludeRules context="values" />
        <DetectChar attribute="Operator" context="#pop!mapping-key" char="?" />
        <RegExpr attribute="Operator" context="#stay" String="\-(?=\s|$)" />

        <DetectChar attribute="Operator" context="#pop!list" char="[" beginRegion="List" />
        <DetectChar attribute="Operator" context="#pop!hash" char="{" beginRegion="Hash" />
        <DetectChar attribute="String" context="#pop!string" char="'" beginRegion="String" />
        <DetectChar attribute="String" context="#pop!stringx" char="&quot;" beginRegion="String" />
      </context>

      <!-- Highlight lists, hashes and strings after a data type, reference or alias -->
      <context attribute="Normal Text" lineEndContext="#pop" name="after-data" fallthrough="true" fallthroughContext="#pop">
        <RegExpr attribute="Comment" context="#pop!comment" String="(?:^|\s+)#" />
        <DetectSpaces />
        <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
        <RegExpr attribute="Alias" context="#stay" String="&alias;" />
        <RegExpr attribute="Reference" context="#stay" String="&reference;" />

        <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
        <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
        <DetectChar attribute="String" context="string" char="'" beginRegion="String" />
        <DetectChar attribute="String" context="stringx" char="&quot;" beginRegion="String" />
      </context>

      <context attribute="Document Header" lineEndContext="#pop" name="header">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
        <RegExpr attribute="Literal/Folded Operator" context="header-literal-operator" String="\s&literalOp;(?=&endValue;)" lookAhead="true" />
      </context>
      <context attribute="Document Header" lineEndContext="#pop#pop" name="header-literal-operator" fallthrough="true" fallthroughContext="#pop">
        <DetectSpaces />
        <RegExpr attribute="Literal/Folded Operator" context="#pop#pop!literal-block-simple" String="&literalOp;" beginRegion="Literal" />
      </context>

      <context attribute="End of Document" lineEndContext="#stay" name="EOD">
      </context>

      <context attribute="Directive" lineEndContext="#pop" name="directive">
      </context>

      <context attribute="Attribute" lineEndContext="#pop#pop" name="attribute">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
      </context>

      <context attribute="Attribute" lineEndContext="#stay" name="list-attribute-inline">
        <AnyChar attribute="Operator" context="#pop#pop" lookAhead="true" String=",]" />
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
      </context>
      <context attribute="Attribute" lineEndContext="#stay" name="hash-attribute-inline">
        <AnyChar attribute="Operator" context="#pop#pop" lookAhead="true" String=",}" />
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
      </context>

      <!-- Attribute -->
      <context attribute="Attribute" lineEndContext="#pop" name="dpoints-attribute-pre" fallthrough="true" fallthroughContext="#pop!attribute-pre">
        <DetectChar attribute="Key Points Operator" context="#pop!attribute-pre" char=":" /> <!-- Highlight two points after Key -->
      </context>
      <context attribute="Attribute" lineEndContext="#pop" name="attribute-pre" fallthrough="true" fallthroughContext="attribute">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
        <DetectSpaces/>
        <DetectChar attribute="Operator" context="#stay" char="?" />
        <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
        <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
        <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
        <DetectChar attribute="String" context="attribute-string" char="'" beginRegion="String" />
        <DetectChar attribute="String" context="attribute-stringx" char="&quot;" beginRegion="String" />
        <RegExpr attribute="Alias" context="#stay" String="&alias;(?=\s+[\[\{])" />
        <RegExpr attribute="Reference" context="#stay" String="&reference;(?=\s+[\[\{])" />
        <RegExpr attribute="Alias" context="attribute" String="&alias;" />
        <RegExpr attribute="Reference" context="attribute" String="&reference;" />
        <IncludeRules context="values" />
        <RegExpr attribute="Literal/Folded Operator" context="#stay" String="&literalOp;(?=&endValue;)" />
      </context>

      <context attribute="Attribute" lineEndContext="#pop" name="default-attribute-pre-inline">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
        <DetectSpaces/>

        <DetectChar attribute="Operator" context="#stay" char="?" />
        <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
        <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
        <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
        <DetectChar attribute="String" context="attribute-string-inline" char="'" beginRegion="String" />
        <DetectChar attribute="String" context="attribute-stringx-inline" char="&quot;" beginRegion="String" />
        <RegExpr attribute="Alias" context="#stay" String="&alias;(?=\s+[\[\{])" />
        <RegExpr attribute="Reference" context="#stay" String="&reference;(?=\s+[\[\{])" />
      </context>

      <!-- Attribute Inline, Within List -->
      <context attribute="Attribute" lineEndContext="#pop" name="dpoints-list-attribute-pre-inline" fallthrough="true" fallthroughContext="#pop!list-attribute-pre-inline">
        <DetectChar attribute="Key Points Operator" context="#pop!list-attribute-pre-inline" char=":" /> <!-- Highlight two points after Key -->
      </context>
      <context attribute="Attribute" lineEndContext="#pop" name="list-attribute-pre-inline" fallthrough="true" fallthroughContext="list-attribute-inline">
        <IncludeRules context="default-attribute-pre-inline" />
        <RegExpr attribute="Alias" context="list-attribute-inline" String="&alias;" />
        <RegExpr attribute="Reference" context="list-attribute-inline" String="&reference;" />

        <AnyChar attribute="Operator" context="#pop" lookAhead="true" String=",]" />
        <IncludeRules context="values-inline" />
      </context>

      <!-- Attribute Inline, Within Hash -->
      <context attribute="Attribute" lineEndContext="#pop" name="dpoints-hash-attribute-pre-inline" fallthrough="true" fallthroughContext="#pop!hash-attribute-pre-inline">
        <DetectChar attribute="Key Points Operator" context="#pop!hash-attribute-pre-inline" char=":" /> <!-- Highlight two points after Key -->
      </context>
      <context attribute="Attribute" lineEndContext="#pop" name="hash-attribute-pre-inline" fallthrough="true" fallthroughContext="hash-attribute-inline">
        <IncludeRules context="default-attribute-pre-inline" />
        <RegExpr attribute="Alias" context="hash-attribute-inline" String="&alias;" />
        <RegExpr attribute="Reference" context="hash-attribute-inline" String="&reference;" />

        <AnyChar attribute="Operator" context="#pop" lookAhead="true" String=",}" />
        <IncludeRules context="values-inline" />
      </context>

      <!-- List -->
      <!-- Context "find-values-list" highlights values and then sends to "list-element" -->
      <context attribute="List" lineEndContext="#stay" name="list" fallthrough="true" fallthroughContext="#pop!find-values-list" noIndentationBasedFolding="true">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
        <DetectSpaces />
        <DetectChar attribute="Operator" context="#pop!find-values-list" char="?" />
      </context>
      <context attribute="List" lineEndContext="#stay" name="list-element" noIndentationBasedFolding="true">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />

        <DetectChar attribute="Operator" context="#pop" char="]" endRegion="List" />
        <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
        <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />

        <RegExpr attribute="Key" context="dpoints-list-attribute-pre-inline" String="&dpointsListAttrPreInline1;|&dpointsListAttrPreInline2;|&dpointsListAttrPreInline3;|&dpointsListAttrPreInline4;"/>
        <RegExpr attribute="Key Points Operator" context="list-attribute-pre-inline" String=":(?=\s|$)" firstNonSpace="true" />

        <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
        <RegExpr attribute="Alias" context="#stay" String="&alias;" />
        <RegExpr attribute="Reference" context="#stay" String="&reference;" />
        <DetectChar attribute="String" context="string" char="'" beginRegion="String" />
        <DetectChar attribute="String" context="stringx" char="&quot;" beginRegion="String" />

        <DetectChar attribute="Operator" context="#pop!list" char="," />
        <IncludeRules context="values-list" />
      </context>

      <!-- Hash -->
      <context attribute="Hash" lineEndContext="#stay" name="hash" fallthrough="true" fallthroughContext="#pop!hash-element" noIndentationBasedFolding="true">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
        <DetectSpaces />
        <DetectChar attribute="Operator" context="#pop!hash-element" char="?" />
      </context>
      <context attribute="Hash" lineEndContext="#stay" name="hash-element" noIndentationBasedFolding="true">
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
        <DetectSpaces/>

        <RegExpr attribute="Key" context="dpoints-hash-attribute-pre-inline" String="&dpointsHashAttrPreInline1;|&dpointsHashAttrPreInline2;|&dpointsHashAttrPreInline3;|&dpointsHashAttrPreInline4;"/>
        <RegExpr attribute="Key Points Operator" context="hash-attribute-pre-inline" String=":(?=\s|$)"/>

        <DetectChar attribute="Operator" context="#pop" char="}" endRegion="Hash" />
        <DetectChar attribute="Operator" context="#pop!hash" char="," />

        <!-- This improves highlighting in keys with multiple lines -->
        <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
        <RegExpr attribute="Alias" context="#stay" String="&alias;" />
        <RegExpr attribute="Reference" context="#stay" String="&reference;" />
        <DetectChar attribute="String" context="string" char="'" beginRegion="String" />
        <DetectChar attribute="String" context="stringx" char="&quot;" beginRegion="String" />
      </context>

      <!-- Strings -->
      <context attribute="String" lineEndContext="#stay" name="attribute-string" noIndentationBasedFolding="true">
        <DetectIdentifier />
        <IncludeRules context="escaped-char-singleq" />
        <DetectChar attribute="String" context="attribute-end" char="'" endRegion="String" />
      </context>

      <context attribute="String" lineEndContext="#stay" name="attribute-stringx" noIndentationBasedFolding="true">
        <DetectIdentifier />
        <IncludeRules context="escaped-char-doubleq" />
        <DetectChar attribute="String" context="attribute-end" char="&quot;" endRegion="String" />
      </context>

      <context attribute="String" lineEndContext="#stay" name="attribute-string-inline" noIndentationBasedFolding="true">
          <DetectIdentifier />
          <IncludeRules context="escaped-char-singleq" />
          <DetectChar attribute="String" context="attribute-end-inline" char="'" endRegion="String" />
      </context>

      <context attribute="String" lineEndContext="#stay" name="attribute-stringx-inline" noIndentationBasedFolding="true">
          <DetectIdentifier />
          <IncludeRules context="escaped-char-doubleq" />
          <DetectChar attribute="String" context="attribute-end-inline" char="&quot;" endRegion="String" />
      </context>

      <context attribute="Error" lineEndContext="#pop#pop#pop" name="attribute-end">
          <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
          <DetectSpaces attribute="Normal Text" context="#stay"/>
      </context>

      <context attribute="Error" lineEndContext="#pop#pop#pop" name="attribute-end-inline">
          <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
          <DetectSpaces attribute="Normal Text" context="#stay"/>
          <AnyChar context="#pop#pop#pop" lookAhead="true" String="}],"/>
      </context>

      <context attribute="String" lineEndContext="#stay" name="string" noIndentationBasedFolding="true">
        <DetectIdentifier />
        <IncludeRules context="escaped-char-singleq" />
        <DetectChar attribute="String" context="#pop" char="'" endRegion="String" />
      </context>

      <context attribute="String" lineEndContext="#stay" name="stringx" noIndentationBasedFolding="true">
        <DetectIdentifier />
        <IncludeRules context="escaped-char-doubleq" />
        <DetectChar attribute="String" context="#pop" char="&quot;" endRegion="String" />
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="escaped-char-doubleq">
        <RegExpr attribute="Escaped Character" context="#stay" String="\\(?:[\s0abtnvfre&quot;/\\N_Lp]|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="escaped-char-singleq">
        <Detect2Chars attribute="Escaped Character" context="#stay" char="'" char1="'" />
      </context>

      <context attribute="Comment" lineEndContext="#pop" name="comment">
        <DetectSpaces />
        <IncludeRules context="##Comments" />
      </context>

      <!-- Values -->
      <context attribute="Normal Text" lineEndContext="#stay" name="values">
        <RegExpr attribute="Null" context="#stay" String="&null;(?=&endValue;)"/>
        <RegExpr attribute="Boolean" context="#stay" String="&bool;(?=&endValue;)"/>
        <RegExpr attribute="Float" context="#stay" String="&allFloat;(?=&endValue;)"/>
        <RegExpr attribute="Integer" context="#stay" String="&allInt;(?=&endValue;)"/>
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="values-firstnonspace">
        <RegExpr attribute="Null" firstNonSpace="true" context="#stay" String="&null;(?=&endValue;)"/>
        <RegExpr attribute="Boolean" firstNonSpace="true" context="#stay" String="&bool;(?=&endValue;)"/>
        <RegExpr attribute="Float" firstNonSpace="true" context="#stay" String="&allFloat;(?=&endValue;)"/>
        <RegExpr attribute="Integer" firstNonSpace="true" context="#stay" String="&allInt;(?=&endValue;)"/>
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="values-inline">
        <RegExpr attribute="Null" context="#stay" String="&null;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Boolean" context="#stay" String="&bool;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Float" context="#stay" String="&allFloat;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Integer" context="#stay" String="&allInt;(?=&endValueInline;|&endValue;)"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="values-list">
        <RegExpr attribute="Null" context="#stay" String="(?:\s|^)&null;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Boolean" context="#stay" String="(?:\s|^)&bool;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Float" context="#stay" String="(?:\s|^)&allFloat;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Integer" context="#stay" String="(?:\s|^)&allInt;(?=&endValueInline;|&endValue;)"/>
      </context>
      <!-- If the value is found immediately at the beginning of the list item -->
      <context attribute="Normal Text" lineEndContext="#pop!list-element" name="find-values-list" fallthrough="true" fallthroughContext="#pop!list-element">
        <RegExpr attribute="Null" context="#pop!list-element" String="&null;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Boolean" context="#pop!list-element" String="&bool;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Float" context="#pop!list-element" String="&allFloat;(?=&endValueInline;|&endValue;)"/>
        <RegExpr attribute="Integer" context="#pop!list-element" String="&allInt;(?=&endValueInline;|&endValue;)"/>
      </context>

      <!-- Literal/Folded Style: http://yaml.org/spec/1.2/spec.html#id2795688 -->

      <context attribute="Normal Text" lineEndContext="#stay" name="find-literal-block">
        <!-- Do not allow indentation with tabs: -->
        <RegExpr attribute="Alert" context="#stay" column="0"
                 String="^&space;*\t+\s*(?=(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|&lt;&gt;&quot;'])?&literalOp;&endValue;)" />

        <!-- CASE 1: The literal/folded operator is the first character of a line.
             The text after a space is considered literal.
             Ex:
             > |
             >  ^Start the literal text
        -->
        <RegExpr attribute="Literal/Folded Operator" context="literal-block-simple" column="0"
                 String="^&literalOp;(?=&endValue;)" beginRegion="Literal" />

        <!-- CASE 2: Only the literal/folded operator is present in a line, after a space (the indentation
             is captured). The text with the same indentation of the operator will be highlighted as literal.
             Ex:
             >  key:
             >    |
             >    ^Start the literal text

             However, in this case, the correct way is to use the indentation of the block, not the
             indentation of the the operator. The problem is that it is difficult to capture.
             >  key1:
             >   key2:
             >    key3:
             >          |
             >     ^Block indentation (correct literal text)
        -->
        <RegExpr attribute="Literal/Folded Operator" context="literal-block-only-operator" column="0"
                 String="^(&space;+)&literalOp;(?=&endValue;)" beginRegion="Literal" />

        <!-- CASE 3: There is a Key before the literal/folded operator (Key indentation is captured).
             The text with the Key's indentation plus a space is considered literal.
             Ex:
             >    key: |
             >     ^Start the literal text
             >  key: !!type >-
             >   ^Start the folded text
        -->
        <RegExpr attribute="Key Points Operator" context="literal-block-key" column="0"
                 String="^(&space;*)\:(?=\s+(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|&lt;&gt;&quot;'])?&literalOp;&endValue;)" />
        <RegExpr attribute="Key" context="literal-block-key" column="0"
                 String="^(&space;*)(?:[^&quot;'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)(?=\:\s+(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|&lt;&gt;&quot;'])?&literalOp;&endValue;)" />

        <!-- CASE 4: Is there an operator "?" or "-" at the beginning of the line.
             NOTE: Nested characters "-" and "?" are considered as part of the indentation.
             Therefore, the indentation of the Key or the last operator "?" or "-" is captured.
             Ex:
             >  ? |
             >   ^Start the literal Text
             >  ? - - |
             >       ^Start the literal text
             >  - Key: |
             >     ^Start the literal text
             >  ? - - - - Key: |
             >             ^Start the literal text
        -->
        <RegExpr context="start-literal-block-withdash" lookAhead="true" column="0"
                 String="^&space;*(?:\?&space;*|\-&space;+){1,6}(?:(?:&keyDQ;|&keySQ;|[^#\-\?\s]|\-[^\s#])(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|&lt;&gt;&quot;'])?)?&literalOp;&endValue;" />

        <!-- CASE 5: Literal/folded operator after a data type or other content.
             Ex:
             >  !!type |
             >   ^Start the literal text
             >  key1:
             >   key2:
             >    !!type |
             >    ^Start the literal text
        -->
        <RegExpr context="start-literal-block-other" lookAhead="true" column="0"
                 String="^&space;*(?:(?:[&amp;\*]|!!)\S+\s+)+&literalOp;&endValue;" />
      </context>

      <!-- If the line with the literal operator starts with the "-" or "?" operator.
           NOTE: The indentation capture is limited to 6 nested operators. -->
      <context attribute="Normal Text" lineEndContext="#pop" name="start-literal-block-withdash" noIndentationBasedFolding="true">
        <!-- With Key: Capture the Key indentation -->
        <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s2" String="^(&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s3" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s4" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s5" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s6" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s7" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
        <!-- Without Key: Capture the indentation of the last operator "?" or "-" -->
        <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s1" String="^(&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s2" String="^(&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s3" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s4" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s5" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
        <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s6" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
      </context>
      <!-- Capture the indentation of data type, reference or alias  -->
      <context attribute="Normal Text" lineEndContext="#pop" name="start-literal-block-other" noIndentationBasedFolding="true">
        <!-- The text with the same indentation will be considered literal -->
        <RegExpr attribute="Data Types" context="#pop!literal-block-after-data" String="^(&space;+)&dataTypes;" column="0" />
        <RegExpr attribute="Alias" context="#pop!literal-block-after-data" String="^(&space;+)&alias;" column="0" />
        <RegExpr attribute="Reference" context="#pop!literal-block-after-data" String="^(&space;+)&reference;" column="0" />
        <!-- The text after a space will be considered literal (empty text is captured) -->
        <RegExpr attribute="Data Types" context="#pop!literal-block-withdash-s1" String="^()&dataTypes;" column="0" />
        <RegExpr attribute="Alias" context="#pop!literal-block-withdash-s1" String="^()&alias;" column="0" />
        <RegExpr attribute="Reference" context="#pop!literal-block-withdash-s1" String="^()&reference;" column="0" />
      </context>

      <!-- Highlight data/attribute before the literal operator (Note that if there is a line
           break within a string or bracket, the literal line will not be highlighted). -->
      <context attribute="Attribute" lineEndContext="#pop#pop" name="before-literal-operator" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Operator" context="#pop!end-literal-operator" String="&literalOp;(?=&endValue;)" beginRegion="Literal" />

        <RegExpr attribute="Error" context="#pop#pop" String="(?:[&amp;\*]|!!)\S*&literalOp;(?=&endValue;)" />
        <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
        <RegExpr attribute="Alias" context="#stay" String="&alias;" />
        <RegExpr attribute="Reference" context="#stay" String="&reference;" />

        <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
        <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
        <DetectChar attribute="String" context="string" char="'" beginRegion="String" />
        <DetectChar attribute="String" context="stringx" char="&quot;" beginRegion="String" />
      </context>

      <context attribute="Normal Text" lineEndContext="#pop#pop" name="dpoints-key-before-literal-operator" fallthrough="true" fallthroughContext="#pop#pop" noIndentationBasedFolding="true">
        <DetectChar attribute="Key Points Operator" context="#pop!key-before-literal-operator" char=":" />
      </context>
      <context attribute="Attribute" lineEndContext="#pop#pop" name="key-before-literal-operator" noIndentationBasedFolding="true">
        <IncludeRules context="before-literal-operator" />
        <DetectChar attribute="Operator" context="#stay" char="?" />
      </context>
      <context attribute="Attribute" lineEndContext="#pop" name="end-literal-operator" noIndentationBasedFolding="true">
        <RegExpr attribute="Comment" context="#pop!comment" String="(?:^|\s+)#" />
      </context>

      <!-- Common rules for the content of the literal blocks -->
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-default" noIndentationBasedFolding="true">
        <!-- End literal/folded block -->
        <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
        <!-- Find literal/folded operator -->
        <RegExpr context="before-literal-operator" String="\S" lookAhead="true" />
      </context>
      <context attribute="Normal Text" lineEndContext="#pop" name="literal-block-key-default" noIndentationBasedFolding="true">
        <!-- End literal/folded block -->
        <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
        <!-- Detect Key before the literal/folded operator -->
        <RegExpr attribute="Key" context="dpoints-key-before-literal-operator" String="&keyAfterOp;(?=:\s)" />
        <RegExpr attribute="Normal Text" context="#pop" String="\S" lookAhead="true" endRegion="Literal" />
      </context>

      <!-- Content of the literal block: -->

      <!-- If the literal operator is starting the line (after a space, use block indentation) -->
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-only-operator" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1.*$" dynamic="true" column="0" />

        <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s)#" />
        <RegExpr context="#pop" String="\S" lookAhead="true" endRegion="Literal" />
      </context>
      <!-- If the literal operator is the first character of a line (or after header) -->
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-simple" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^\s.*$" column="0" />

        <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
        <RegExpr attribute="Comment" context="comment" String="(?:^|\s)#" />
      </context>
      <!-- If there is a data type or other content before the liretal operator (use block indentation) -->
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-after-data" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1.*$" dynamic="true" column="0" />

        <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
        <RegExpr context="before-literal-operator" String="\S" lookAhead="true" />
      </context>
      <!-- If there is a key before the literal operator -->
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1\s.*$" dynamic="true" column="0" />

        <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
        <!-- Attribute of the Key (the Key was previously highlighted) -->
        <RegExpr attribute="Key Points Operator" context="key-before-literal-operator" String=":\s" />
        <RegExpr context="key-before-literal-operator" String="\S" lookAhead="true" />
      </context>

      <!-- If there are dashes/"?" before the literal operator -->
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s1" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s2" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2&space;\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s3" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3&space;{2}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s4" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4&space;{3}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s5" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5&space;{4}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s6" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6&space;{5}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-default" />
      </context>
      <!-- If there are dashes/"?" and a Key before the literal operator -->
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s2" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2&space;\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-key-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s3" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3&space;{2}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-key-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s4" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4&space;{3}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-key-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s5" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5&space;{4}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-key-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s6" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6&space;{5}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-key-default" />
      </context>
      <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s7" dynamic="true" noIndentationBasedFolding="true">
        <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6%7&space;{6}\s.*$" dynamic="true" column="0" />
        <IncludeRules context="literal-block-key-default" />
      </context>
    </contexts>

    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsAttribute" />
      <itemData name="Attribute" defStyleNum="dsAttribute" />
      <itemData name="List" defStyleNum="dsAttribute" />
      <itemData name="Hash" defStyleNum="dsAttribute" />
      <itemData name="Comment" defStyleNum="dsComment" />
      <itemData name="End of Document" defStyleNum="dsComment" />
      <itemData name="Document Header" defStyleNum="dsPreprocessor" />
      <itemData name="Data Types" defStyleNum="dsOthers" />
      <itemData name="Alias" defStyleNum="dsOthers" />
      <itemData name="Reference" defStyleNum="dsOthers" />
      <itemData name="Key" defStyleNum="dsFunction" bold="1" />
      <itemData name="Directive" defStyleNum="dsPreprocessor" />
      <itemData name="Key Points Operator" defStyleNum="dsKeyword" />
      <itemData name="Operator" defStyleNum="dsKeyword" />
      <itemData name="String" defStyleNum="dsString" />
      <itemData name="Escaped Character" defStyleNum="dsSpecialChar" />
      <itemData name="Literal/Folded Operator" defStyleNum="dsChar" bold="1" />
      <itemData name="Literal/Folded Block" defStyleNum="dsNormal" />
      <itemData name="Null" defStyleNum="dsChar" />
      <itemData name="Boolean" defStyleNum="dsChar" />
      <itemData name="Integer" defStyleNum="dsDecVal" />
      <itemData name="Float" defStyleNum="dsFloat" />
      <itemData name="Error" defStyleNum="dsError" />
      <itemData name="Alert" defStyleNum="dsAlert" backgroundColor="#EF9A9A" />
    </itemDatas>
  </highlighting>

  <general>
    <folding indentationsensitive="1" />
    <emptyLines>
      <emptyLine regexpr="(?:\s+|\s*#.*)"/>
    </emptyLines>
    <comments>
      <comment name="singleLine" start="#" position="afterwhitespace" />
    </comments>
    <keywords casesensitive="1"/>
  </general>
</language>
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->