-
Notifications
You must be signed in to change notification settings - Fork 0
/
yaml-jinja2.xml
637 lines (568 loc) · 38 KB
/
yaml-jinja2.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
<!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;|∫)">
<!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 ""(?:\\.|[^"])+"\s*">
<!ENTITY keySQ "'(?:[^']|'')+'\s*">
<!-- Literal/folded operator -->
<!ENTITY literalOp "[\|>][\-\+]?">
<!-- Key after "?" or "-", used to detect literal/folded operator -->
<!ENTITY keyAfterOp "(?:[^"'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)">
]>
<!-- Author: Dr Orlovsky MA <maxim@orlovsky.info> //-->
<!-- Modifications, values & support for literal/folded style:
Nibaldo González S. <nibgonz@gmail.com> //-->
<!-- Autogenerated from yaml.xml -->
<language name="Jinja2/YAML" version="5" kateversion="5.0" section="Markup"
extensions="*.yaml;*.yml" mimetype="text/yaml"
author="Dr Orlovsky MA (dr.orlovsky@gmail.com)" license="LGPL">
<highlighting>
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="normal" >
<IncludeRules context="FindJinja" />
<StringDetect attribute="Document Header" context="header" String="---" column="0"/>
<RegExpr attribute="End of Document" context="EOD" String="^\.\.\.$"/>
<DetectChar attribute="Directive" context="directive" char="%" column="0"/>
<DetectChar attribute="Comment" context="comment" char="#" />
<!-- 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" context="list" char="[" beginRegion="List" />
<DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
<RegExpr attribute="Data Types" firstNonSpace="true" context="#stay" String="!!\S+" />
<RegExpr attribute="Alias" firstNonSpace="true" context="#stay" String="&\S+" />
<RegExpr attribute="Reference" firstNonSpace="true" context="#stay" String="\*\S+" />
<RegExpr attribute="Key" context="attribute-pre" String="[^"'#\-\s][^:#]*:(?=\s|$)"/>
<RegExpr attribute="Key" context="attribute-pre" String="\-([^\s:#][^:#]*)?\:(?=\s|$)"/>
<RegExpr attribute="Key" context="attribute-pre" String="&keyDQ;:(?=\s|$)"/>
<RegExpr attribute="Key" context="attribute-pre" String="&keySQ;:(?=\s|$)"/>
<RegExpr attribute="Key" context="attribute-pre" String=":(?=\s|$)"/>
<DetectChar attribute="String" context="string" char="'" beginRegion="String" />
<DetectChar attribute="String" context="stringx" char=""" beginRegion="String" />
<IncludeRules context="values-firstnonspace" />
<DetectSpaces/>
</context>
<context attribute="Normal Text" lineEndContext="#pop" name="mapping-key" fallthrough="true" fallthroughContext="#pop">
<IncludeRules context="FindJinja" />
<DetectSpaces />
<RegExpr attribute="Operator" context="#pop!dash" String="\-(?=\s|$)" />
<RegExpr attribute="Data Types" context="#pop" String="!!\S+" />
<RegExpr attribute="Alias" context="#pop" String="&\S+" />
<RegExpr attribute="Reference" context="#pop" String="\*\S+" />
</context>
<context attribute="List" lineEndContext="#pop" name="dash" fallthrough="true" fallthroughContext="#pop">
<IncludeRules context="FindJinja" />
<DetectSpaces/>
<DetectChar attribute="Comment" context="comment" char="#" />
<RegExpr attribute="Data Types" context="#stay" String="!!\S+" />
<RegExpr attribute="Alias" context="#stay" String="&\S+" />
<RegExpr attribute="Reference" context="#stay" String="\*\S+" />
<IncludeRules context="values" />
<DetectChar attribute="Operator" context="#pop!mapping-key" char="?" />
<RegExpr attribute="Operator" context="#stay" String="\-(?=\s|$)" />
</context>
<context attribute="Document Header" lineEndContext="#pop" name="header">
<IncludeRules context="FindJinja" />
<DetectChar attribute="Comment" context="comment" char="#" />
<RegExpr attribute="Literal/Folded Operator" context="#pop!literal-block-simple" String="&literalOp;(?=&endValue;)" beginRegion="Literal" />
</context>
<context attribute="End of Document" lineEndContext="#stay" name="EOD">
<IncludeRules context="FindJinja" />
</context>
<context attribute="Directive" lineEndContext="#pop" name="directive">
<IncludeRules context="FindJinja" />
</context>
<context attribute="Attribute" lineEndContext="#pop#pop" name="attribute">
<IncludeRules context="FindJinja" />
<DetectChar attribute="Comment" context="comment" char="#" />
</context>
<context attribute="Attribute" lineEndContext="#stay" name="list-attribute-inline">
<IncludeRules context="FindJinja" />
<AnyChar attribute="Operator" context="#pop#pop" lookAhead="true" String=",]" />
<DetectChar attribute="Comment" context="comment" char="#" />
</context>
<context attribute="Attribute" lineEndContext="#stay" name="hash-attribute-inline">
<IncludeRules context="FindJinja" />
<AnyChar attribute="Operator" context="#pop#pop" lookAhead="true" String=",}" />
<DetectChar attribute="Comment" context="comment" char="#" />
</context>
<context attribute="Attribute" lineEndContext="#pop" name="attribute-pre" fallthrough="true" fallthroughContext="attribute">
<IncludeRules context="FindJinja" />
<DetectSpaces/>
<DetectChar attribute="Comment" context="comment" char="#" />
<DetectChar attribute="Operator" context="#stay" char="?" />
<RegExpr attribute="Data Types" context="#stay" String="!!\S+" />
<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=""" beginRegion="String" />
<RegExpr attribute="Alias" context="#stay" String="&\S+(?=\s+[\[\{])" />
<RegExpr attribute="Reference" context="#stay" String="\*\S+(?=\s+[\[\{])" />
<RegExpr attribute="Alias" context="attribute" String="&\S+" />
<RegExpr attribute="Reference" context="attribute" String="\*\S+" />
<IncludeRules context="values" />
</context>
<context attribute="Attribute" lineEndContext="#pop" name="default-attribute-pre-inline">
<IncludeRules context="FindJinja" />
<DetectSpaces/>
<DetectChar attribute="Comment" context="comment" char="#" />
<DetectChar attribute="Operator" context="#stay" char="?" />
<RegExpr attribute="Data Types" context="#stay" String="!!\S+" />
<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=""" beginRegion="String" />
<RegExpr attribute="Alias" context="#stay" String="&\S+(?=\s+[\[\{])" />
<RegExpr attribute="Reference" context="#stay" String="\*\S+(?=\s+[\[\{])" />
</context>
<context attribute="Attribute" lineEndContext="#pop" name="list-attribute-pre-inline" fallthrough="true" fallthroughContext="list-attribute-inline">
<IncludeRules context="FindJinja" />
<IncludeRules context="default-attribute-pre-inline" />
<RegExpr attribute="Alias" context="list-attribute-inline" String="&\S+" />
<RegExpr attribute="Reference" context="list-attribute-inline" String="\*\S+" />
<AnyChar attribute="Operator" context="#pop" lookAhead="true" String=",]" />
<IncludeRules context="values-inline" />
</context>
<context attribute="Attribute" lineEndContext="#pop" name="hash-attribute-pre-inline" fallthrough="true" fallthroughContext="hash-attribute-inline">
<IncludeRules context="FindJinja" />
<IncludeRules context="default-attribute-pre-inline" />
<RegExpr attribute="Alias" context="hash-attribute-inline" String="&\S+" />
<RegExpr attribute="Reference" context="hash-attribute-inline" String="\*\S+" />
<AnyChar attribute="Operator" context="#pop" lookAhead="true" String=",}" />
<IncludeRules context="values-inline" />
</context>
<!-- 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">
<IncludeRules context="FindJinja" />
<DetectSpaces />
<DetectChar attribute="Operator" context="#pop!find-values-list" char="?" />
<DetectChar attribute="Comment" context="comment" char="#" />
</context>
<context attribute="List" lineEndContext="#stay" name="list-element">
<IncludeRules context="FindJinja" />
<DetectChar attribute="Comment" context="comment" char="#" />
<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="list-attribute-pre-inline" String="[^"'#\-,\]\s][^:#,\]]*:(?=\s|$)"/>
<RegExpr attribute="Key" context="list-attribute-pre-inline" String="\-([^\s:#,\]][^:#,\]]*)?\:(?=\s|$)"/>
<RegExpr attribute="Key" context="list-attribute-pre-inline" String="&keyDQ;:(?=\s|$)"/>
<RegExpr attribute="Key" context="list-attribute-pre-inline" String="&keySQ;:(?=\s|$)"/>
<RegExpr attribute="Key" context="list-attribute-pre-inline" String=":(?=\s|$)" firstNonSpace="true" />
<RegExpr attribute="Data Types" context="#stay" String="!!\S+" />
<RegExpr attribute="Alias" context="#stay" String="&\S+" />
<RegExpr attribute="Reference" context="#stay" String="\*\S+" />
<DetectChar attribute="String" context="string" char="'" beginRegion="String" />
<DetectChar attribute="String" context="stringx" char=""" beginRegion="String" />
<DetectChar attribute="Operator" context="#pop!list" char="," />
<IncludeRules context="values-list" />
</context>
<context attribute="Hash" lineEndContext="#stay" name="hash" fallthrough="true" fallthroughContext="#pop!hash-element">
<IncludeRules context="FindJinja" />
<DetectSpaces />
<DetectChar attribute="Operator" context="#pop!hash-element" char="?" />
<DetectChar attribute="Comment" context="comment" char="#" />
</context>
<context attribute="Hash" lineEndContext="#stay" name="hash-element">
<IncludeRules context="FindJinja" />
<DetectSpaces/>
<DetectChar attribute="Comment" context="comment" char="#" />
<RegExpr attribute="Key" context="hash-attribute-pre-inline" String="[^\s"'#\-,\}\s][^:#,\}]*:(?=\s|$)"/>
<RegExpr attribute="Key" context="hash-attribute-pre-inline" String="\-([^\s:#,\}][^:#,\}]*)?\:(?=\s|$)"/>
<RegExpr attribute="Key" context="hash-attribute-pre-inline" String="&keyDQ;:(?=\s|$)"/>
<RegExpr attribute="Key" context="hash-attribute-pre-inline" String="&keySQ;:(?=\s|$)"/>
<RegExpr attribute="Key" 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="!!\S+" />
<RegExpr attribute="Alias" context="#stay" String="&\S+" />
<RegExpr attribute="Reference" context="#stay" String="\*\S+" />
<DetectChar attribute="String" context="string" char="'" beginRegion="String" />
<DetectChar attribute="String" context="stringx" char=""" beginRegion="String" />
</context>
<context attribute="String" lineEndContext="#stay" name="attribute-string">
<IncludeRules context="FindJinja" />
<DetectIdentifier />
<IncludeRules context="escaped-char-singleq" />
<DetectChar attribute="String" context="attribute-end" char="'" endRegion="String" />
</context>
<context attribute="String" lineEndContext="#stay" name="attribute-stringx">
<IncludeRules context="FindJinja" />
<DetectIdentifier />
<IncludeRules context="escaped-char-doubleq" />
<DetectChar attribute="String" context="attribute-end" char=""" endRegion="String" />
</context>
<context attribute="String" lineEndContext="#stay" name="attribute-string-inline">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<DetectIdentifier />
<IncludeRules context="escaped-char-doubleq" />
<DetectChar attribute="String" context="attribute-end-inline" char=""" endRegion="String" />
</context>
<context attribute="Error" lineEndContext="#pop#pop#pop" name="attribute-end">
<IncludeRules context="FindJinja" />
<DetectSpaces attribute="Normal Text" context="#stay"/>
<DetectChar attribute="Comment" context="comment" char="#" />
</context>
<context attribute="Error" lineEndContext="#pop#pop#pop" name="attribute-end-inline">
<IncludeRules context="FindJinja" />
<DetectSpaces attribute="Normal Text" context="#stay"/>
<AnyChar attribute="String" context="#pop#pop#pop" lookAhead="true" String="}]"/>
<DetectChar attribute="Operator" context="#pop#pop#pop" lookAhead="true" char="," />
<DetectChar attribute="Comment" context="comment" char="#" />
</context>
<context attribute="String" lineEndContext="#stay" name="string">
<IncludeRules context="FindJinja" />
<DetectIdentifier />
<IncludeRules context="escaped-char-singleq" />
<DetectChar attribute="String" context="#pop" char="'" endRegion="String" />
</context>
<context attribute="String" lineEndContext="#stay" name="stringx">
<IncludeRules context="FindJinja" />
<DetectIdentifier />
<IncludeRules context="escaped-char-doubleq" />
<DetectChar attribute="String" context="#pop" char=""" endRegion="String" />
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="escaped-char-doubleq">
<IncludeRules context="FindJinja" />
<RegExpr attribute="Escaped Character" context="#stay" String="\\([\s0abtnvfre"/\\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">
<IncludeRules context="FindJinja" />
<Detect2Chars attribute="Escaped Character" context="#stay" char="'" char1="'" />
</context>
<context attribute="Comment" lineEndContext="#pop" name="comment">
<IncludeRules context="FindJinja" />
<IncludeRules context="##Alerts" />
<IncludeRules context="##Modelines" />
</context>
<!-- Values -->
<context attribute="Normal Text" lineEndContext="#stay" name="values">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<!-- Do not allow indentation with tabs: -->
<RegExpr attribute="Alert" context="#stay" column="0"
String="^&space;*\t+\s*(?=((&keyDQ;|&keySQ;|[^#])*[^#\w\|<>"'])?&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" context="literal-block-key" column="0"
String="^(&space;*)(?:[^"'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)?\:(?=\s+(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|<>"'])?&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\|<>"'])?)?&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;*(([&\*]|!!)\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">
<IncludeRules context="FindJinja" />
<!-- 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">
<IncludeRules context="FindJinja" />
<!-- The text with the same indentation will be considered literal -->
<RegExpr attribute="Data Types" context="#pop!literal-block-after-data" String="^(&space;+)!!\S+" column="0" />
<RegExpr attribute="Alias" context="#pop!literal-block-after-data" String="^(&space;+)&\S+" column="0" />
<RegExpr attribute="Reference" context="#pop!literal-block-after-data" String="^(&space;+)\*\S+" 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="^()!!\S+" column="0" />
<RegExpr attribute="Alias" context="#pop!literal-block-withdash-s1" String="^()&\S+" column="0" />
<RegExpr attribute="Reference" context="#pop!literal-block-withdash-s1" String="^()\*\S+" 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="Normal Text" lineEndContext="#pop#pop" name="before-literal-operator">
<IncludeRules context="FindJinja" />
<RegExpr attribute="Literal/Folded Operator" context="#pop!end-literal-operator" String="&literalOp;(?=&endValue;)" beginRegion="Literal" />
<RegExpr attribute="Error" context="#pop#pop" String="([&\*]|!!)\S*&literalOp;(?=&endValue;)" />
<RegExpr attribute="Data Types" context="#stay" String="!!\S+" />
<RegExpr attribute="Alias" context="#stay" String="&\S+" />
<RegExpr attribute="Reference" context="#stay" String="\*\S+" />
<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=""" beginRegion="String" />
</context>
<context attribute="Attribute" lineEndContext="#pop#pop" name="key-before-literal-operator">
<IncludeRules context="FindJinja" />
<IncludeRules context="before-literal-operator" />
<DetectChar attribute="Operator" context="#stay" char="?" />
</context>
<context attribute="Normal Text" lineEndContext="#pop" name="end-literal-operator">
<IncludeRules context="FindJinja" />
<DetectChar attribute="Comment" context="#pop!comment" char="#" />
</context>
<!-- Common rules for the content of the literal blocks -->
<context attribute="Normal Text" lineEndContext="#stay" name="literal-block-default">
<IncludeRules context="FindJinja" />
<!-- 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">
<IncludeRules context="FindJinja" />
<!-- 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="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">
<IncludeRules context="FindJinja" />
<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" />
<DetectChar attribute="Comment" context="comment" char="#" />
<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">
<IncludeRules context="FindJinja" />
<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" />
<DetectChar attribute="Comment" context="comment" char="#" />
</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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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 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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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">
<IncludeRules context="FindJinja" />
<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>
<context name="FindJinja">
<Detect2Chars context="##Jinja2" char="{" char1="{" lookAhead="true" />
<Detect2Chars context="##Jinja2" char="{" char1="%" lookAhead="true" />
<Detect2Chars context="##Jinja2" char="#" char1="#" lookAhead="true" />
<Detect2Chars context="##Jinja2" char="{" char1="#" lookAhead="true" />
<DetectChar char="%" firstNonSpace="true" context="##Jinja2" lookAhead="true" />
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="List" defStyleNum="dsNormal" />
<itemData name="Hash" defStyleNum="dsNormal" />
<itemData name="Comment" defStyleNum="dsComment" />
<itemData name="End of Document" defStyleNum="dsComment" />
<itemData name="Attribute" defStyleNum="dsAttribute" />
<itemData name="Document Header" defStyleNum="dsOthers" />
<itemData name="Data Types" defStyleNum="dsDataType" />
<itemData name="Alias" defStyleNum="dsDataType" />
<itemData name="Reference" defStyleNum="dsDataType" />
<itemData name="Key" defStyleNum="dsFunction" />
<itemData name="Directive" defStyleNum="dsOthers" />
<itemData name="Operator" defStyleNum="dsKeyword" />
<itemData name="String" defStyleNum="dsString" />
<itemData name="Escaped Character" defStyleNum="dsSpecialChar" />
<itemData name="Literal/Folded Operator" defStyleNum="dsString" 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>
<comments>
<comment name="singleLine" start="#" position="afterwhitespace" />
</comments>
<keywords casesensitive="1"/>
</general>
</language>