Debian Codegraph @

data/syntax/yaml.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language
3 [
4 <!ENTITY null "(?:null|Null|NULL|~)">
5 <!ENTITY bool "(?:y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)">
6
7 <!ENTITY int "(?:0|[\-\+]?[1-9][0-9_]*)">
8 <!ENTITY intOther "[\-\+]?0(?:x_*[0-9a-fA-F][0-9a-fA-F_]*|o?_*[0-7][0-7_]*|b_*[01][01_]*)"> <!-- Hex, Octal, Binary -->
9 <!ENTITY intBase60 "[\-\+]?[1-9][0-9_]*(?:\:[0-5]?[0-9])+">
10 <!ENTITY allInt "(?:&intBase60;|&intOther;|&int;)">
11
12 <!ENTITY float "[\-\+]?(?:[0-9][0-9_]*\.[0-9\._]*|\._*[0-9][0-9\._]*)(?:[eE][\-\+]?[0-9]+)?">
13 <!ENTITY floatExp "[\-\+]?[0-9][0-9_]*[eE][\-\+]?[0-9]+">
14 <!ENTITY floatBase60 "[\-\+]?[0-9][0-9_]*(?:\:[0-5]?[0-9])+\.[0-9_]*">
15 <!ENTITY inf "[\-\+]?\.(?:inf|Inf|INF)\b">
16 <!ENTITY nan "\.(?:nan|NaN|NAN)\b">
17 <!ENTITY allFloat "(?:&float;|&floatExp;|&floatBase60;|&inf;|&nan;)">
18
19 <!ENTITY endValue "(?:\s*$|\s+#)">
20 <!ENTITY endValueInline "\s*[:,\[\]\{\}]">
21 <!ENTITY space "[ ]">
22
23 <!-- Key quoted -->
24 <!ENTITY keyDQ "&quot;(?:\\.|[^&quot;])+&quot;\s*">
25 <!ENTITY keySQ "'(?:[^']|'')+'\s*">
26 <!-- Literal/folded operator -->
27 <!ENTITY literalOp "[\|&gt;][\-\+]?">
28 <!-- Key after "?" or "-", used to detect literal/folded operator -->
29 <!ENTITY keyAfterOp "(?:[^&quot;'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)">
30
31 <!ENTITY dataTypes "!!\S+">
32 <!ENTITY alias "&amp;\S+">
33 <!ENTITY reference "\*\S+">
34
35 <!ENTITY dpointsHashAttrPreInline1 "[^\s&quot;'#\-,\}\s][^:#,\}]*(?=\:(?:\s|$))">
36 <!ENTITY dpointsHashAttrPreInline2 "\-(?:[^\s:#,\}][^:#,\}]*)?(?=\:(?:\s|$))">
37 <!ENTITY dpointsHashAttrPreInline3 "&keyDQ;(?=\:(?:\s|$))">
38 <!ENTITY dpointsHashAttrPreInline4 "&keySQ;(?=\:(?:\s|$))">
39
40 <!ENTITY dpointsListAttrPreInline1 "[^&quot;'#\-,\]\s][^:#,\]]*(?=\:(?:\s|$))">
41 <!ENTITY dpointsListAttrPreInline2 "\-(?:[^\s:#,\]][^:#,\]]*)?(?=\:(?:\s|$))">
42 <!ENTITY dpointsListAttrPreInline3 "&keyDQ;(?=\:(?:\s|$))">
43 <!ENTITY dpointsListAttrPreInline4 "&keySQ;(?=\:(?:\s|$))">
44
45 <!ENTITY dpointsAttrPre1 "[^&quot;'#\-\s][^:#]*(?=\:(?:\s|$))">
46 <!ENTITY dpointsAttrPre2 "\-(?:[^\s:#][^:#]*)?(?=\:(?:\s|$))">
47 <!ENTITY dpointsAttrPre3 "&keyDQ;(?=\:(?:\s|$))">
48 <!ENTITY dpointsAttrPre4 "&keySQ;(?=\:(?:\s|$))">
49
50 ]>
51
52 <!-- Author: Dr Orlovsky MA <[email protected]> //-->
53 <!-- Modifications (YAML 1.2), values & support for literal/folded style:
54 Nibaldo González S. <[email protected]>
55 These modifications are under the MIT license. //-->
56 <language name="YAML" version="11" kateversion="5.0" section="Markup"
57 extensions="*.yaml;*.yml" mimetype="text/yaml" priority="9"
58 author="Dr Orlovsky MA ([email protected]), Nibaldo González ([email protected])" license="LGPL">
59 <highlighting>
60 <contexts>
61 <context attribute="Attribute" lineEndContext="#stay" name="normal" >
62 <StringDetect attribute="Document Header" context="header" String="---" column="0"/>
63 <RegExpr attribute="End of Document" context="EOD" String="^\.\.\.$" column="0"/>
64 <DetectChar attribute="Directive" context="directive" char="%" column="0"/>
65
66 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
67
68 <!-- Literal/Folded Style -->
69 <IncludeRules context="find-literal-block" />
70
71 <RegExpr attribute="Operator" firstNonSpace="true" context="dash" String="\-(?=\s|$)" />
72 <DetectChar attribute="Operator" firstNonSpace="true" context="mapping-key" char="?" />
73
74 <DetectChar attribute="Operator" firstNonSpace="true" context="list" char="[" beginRegion="List" />
75 <DetectChar attribute="Operator" firstNonSpace="true" context="hash" char="{" beginRegion="Hash" />
76
77 <RegExpr attribute="Data Types" firstNonSpace="true" context="after-data" String="&dataTypes;" />
78 <RegExpr attribute="Alias" firstNonSpace="true" context="after-data" String="&alias;" />
79 <RegExpr attribute="Reference" firstNonSpace="true" context="after-data" String="&reference;" />
80
81 <RegExpr attribute="Key" context="dpoints-attribute-pre" String="&dpointsAttrPre1;|&dpointsAttrPre2;|&dpointsAttrPre3;|&dpointsAttrPre4;"/>
82 <RegExpr attribute="Key Points Operator" context="attribute-pre" String=":(?=\s|$)"/>
83
84 <DetectChar attribute="String" firstNonSpace="true" context="string" char="'" beginRegion="String" />
85 <DetectChar attribute="String" firstNonSpace="true" context="stringx" char="&quot;" beginRegion="String" />
86 <IncludeRules context="values-firstnonspace" />
87 <DetectSpaces/>
88 </context>
89
90 <context attribute="Normal Text" lineEndContext="#pop" name="mapping-key" fallthrough="true" fallthroughContext="#pop">
91 <RegExpr attribute="Comment" context="#pop!comment" String="(?:^|\s+)#" />
92 <DetectSpaces />
93 <RegExpr attribute="Operator" context="#pop!dash" String="\-(?=\s|$)" />
94 <RegExpr attribute="Data Types" context="#pop!after-data" String="&dataTypes;" />
95 <RegExpr attribute="Alias" context="#pop!after-data" String="&alias;" />
96 <RegExpr attribute="Reference" context="#pop!after-data" String="&reference;" />
97
98 <DetectChar attribute="Operator" context="#pop!list" char="[" beginRegion="List" />
99 <DetectChar attribute="Operator" context="#pop!hash" char="{" beginRegion="Hash" />
100 <DetectChar attribute="String" context="#pop!string" char="'" beginRegion="String" />
101 <DetectChar attribute="String" context="#pop!stringx" char="&quot;" beginRegion="String" />
102 </context>
103
104 <context attribute="Normal Text" lineEndContext="#pop" name="dash" fallthrough="true" fallthroughContext="#pop">
105 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
106 <DetectSpaces/>
107 <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
108 <RegExpr attribute="Alias" context="#stay" String="&alias;" />
109 <RegExpr attribute="Reference" context="#stay" String="&reference;" />
110 <IncludeRules context="values" />
111 <DetectChar attribute="Operator" context="#pop!mapping-key" char="?" />
112 <RegExpr attribute="Operator" context="#stay" String="\-(?=\s|$)" />
113
114 <DetectChar attribute="Operator" context="#pop!list" char="[" beginRegion="List" />
115 <DetectChar attribute="Operator" context="#pop!hash" char="{" beginRegion="Hash" />
116 <DetectChar attribute="String" context="#pop!string" char="'" beginRegion="String" />
117 <DetectChar attribute="String" context="#pop!stringx" char="&quot;" beginRegion="String" />
118 </context>
119
120 <!-- Highlight lists, hashes and strings after a data type, reference or alias -->
121 <context attribute="Normal Text" lineEndContext="#pop" name="after-data" fallthrough="true" fallthroughContext="#pop">
122 <RegExpr attribute="Comment" context="#pop!comment" String="(?:^|\s+)#" />
123 <DetectSpaces />
124 <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
125 <RegExpr attribute="Alias" context="#stay" String="&alias;" />
126 <RegExpr attribute="Reference" context="#stay" String="&reference;" />
127
128 <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
129 <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
130 <DetectChar attribute="String" context="string" char="'" beginRegion="String" />
131 <DetectChar attribute="String" context="stringx" char="&quot;" beginRegion="String" />
132 </context>
133
134 <context attribute="Document Header" lineEndContext="#pop" name="header">
135 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
136 <RegExpr attribute="Literal/Folded Operator" context="header-literal-operator" String="\s&literalOp;(?=&endValue;)" lookAhead="true" />
137 </context>
138 <context attribute="Document Header" lineEndContext="#pop#pop" name="header-literal-operator" fallthrough="true" fallthroughContext="#pop">
139 <DetectSpaces />
140 <RegExpr attribute="Literal/Folded Operator" context="#pop#pop!literal-block-simple" String="&literalOp;" beginRegion="Literal" />
141 </context>
142
143 <context attribute="End of Document" lineEndContext="#stay" name="EOD">
144 </context>
145
146 <context attribute="Directive" lineEndContext="#pop" name="directive">
147 </context>
148
149 <context attribute="Attribute" lineEndContext="#pop#pop" name="attribute">
150 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
151 </context>
152
153 <context attribute="Attribute" lineEndContext="#stay" name="list-attribute-inline">
154 <AnyChar attribute="Operator" context="#pop#pop" lookAhead="true" String=",]" />
155 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
156 </context>
157 <context attribute="Attribute" lineEndContext="#stay" name="hash-attribute-inline">
158 <AnyChar attribute="Operator" context="#pop#pop" lookAhead="true" String=",}" />
159 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
160 </context>
161
162 <!-- Attribute -->
163 <context attribute="Attribute" lineEndContext="#pop" name="dpoints-attribute-pre" fallthrough="true" fallthroughContext="#pop!attribute-pre">
164 <DetectChar attribute="Key Points Operator" context="#pop!attribute-pre" char=":" /> <!-- Highlight two points after Key -->
165 </context>
166 <context attribute="Attribute" lineEndContext="#pop" name="attribute-pre" fallthrough="true" fallthroughContext="attribute">
167 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
168 <DetectSpaces/>
169 <DetectChar attribute="Operator" context="#stay" char="?" />
170 <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
171 <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
172 <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
173 <DetectChar attribute="String" context="attribute-string" char="'" beginRegion="String" />
174 <DetectChar attribute="String" context="attribute-stringx" char="&quot;" beginRegion="String" />
175 <RegExpr attribute="Alias" context="#stay" String="&alias;(?=\s+[\[\{])" />
176 <RegExpr attribute="Reference" context="#stay" String="&reference;(?=\s+[\[\{])" />
177 <RegExpr attribute="Alias" context="attribute" String="&alias;" />
178 <RegExpr attribute="Reference" context="attribute" String="&reference;" />
179 <IncludeRules context="values" />
180 <RegExpr attribute="Literal/Folded Operator" context="#stay" String="&literalOp;(?=&endValue;)" />
181 </context>
182
183 <context attribute="Attribute" lineEndContext="#pop" name="default-attribute-pre-inline">
184 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
185 <DetectSpaces/>
186
187 <DetectChar attribute="Operator" context="#stay" char="?" />
188 <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
189 <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
190 <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
191 <DetectChar attribute="String" context="attribute-string-inline" char="'" beginRegion="String" />
192 <DetectChar attribute="String" context="attribute-stringx-inline" char="&quot;" beginRegion="String" />
193 <RegExpr attribute="Alias" context="#stay" String="&alias;(?=\s+[\[\{])" />
194 <RegExpr attribute="Reference" context="#stay" String="&reference;(?=\s+[\[\{])" />
195 </context>
196
197 <!-- Attribute Inline, Within List -->
198 <context attribute="Attribute" lineEndContext="#pop" name="dpoints-list-attribute-pre-inline" fallthrough="true" fallthroughContext="#pop!list-attribute-pre-inline">
199 <DetectChar attribute="Key Points Operator" context="#pop!list-attribute-pre-inline" char=":" /> <!-- Highlight two points after Key -->
200 </context>
201 <context attribute="Attribute" lineEndContext="#pop" name="list-attribute-pre-inline" fallthrough="true" fallthroughContext="list-attribute-inline">
202 <IncludeRules context="default-attribute-pre-inline" />
203 <RegExpr attribute="Alias" context="list-attribute-inline" String="&alias;" />
204 <RegExpr attribute="Reference" context="list-attribute-inline" String="&reference;" />
205
206 <AnyChar attribute="Operator" context="#pop" lookAhead="true" String=",]" />
207 <IncludeRules context="values-inline" />
208 </context>
209
210 <!-- Attribute Inline, Within Hash -->
211 <context attribute="Attribute" lineEndContext="#pop" name="dpoints-hash-attribute-pre-inline" fallthrough="true" fallthroughContext="#pop!hash-attribute-pre-inline">
212 <DetectChar attribute="Key Points Operator" context="#pop!hash-attribute-pre-inline" char=":" /> <!-- Highlight two points after Key -->
213 </context>
214 <context attribute="Attribute" lineEndContext="#pop" name="hash-attribute-pre-inline" fallthrough="true" fallthroughContext="hash-attribute-inline">
215 <IncludeRules context="default-attribute-pre-inline" />
216 <RegExpr attribute="Alias" context="hash-attribute-inline" String="&alias;" />
217 <RegExpr attribute="Reference" context="hash-attribute-inline" String="&reference;" />
218
219 <AnyChar attribute="Operator" context="#pop" lookAhead="true" String=",}" />
220 <IncludeRules context="values-inline" />
221 </context>
222
223 <!-- List -->
224 <!-- Context "find-values-list" highlights values and then sends to "list-element" -->
225 <context attribute="List" lineEndContext="#stay" name="list" fallthrough="true" fallthroughContext="#pop!find-values-list" noIndentationBasedFolding="true">
226 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
227 <DetectSpaces />
228 <DetectChar attribute="Operator" context="#pop!find-values-list" char="?" />
229 </context>
230 <context attribute="List" lineEndContext="#stay" name="list-element" noIndentationBasedFolding="true">
231 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
232
233 <DetectChar attribute="Operator" context="#pop" char="]" endRegion="List" />
234 <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
235 <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
236
237 <RegExpr attribute="Key" context="dpoints-list-attribute-pre-inline" String="&dpointsListAttrPreInline1;|&dpointsListAttrPreInline2;|&dpointsListAttrPreInline3;|&dpointsListAttrPreInline4;"/>
238 <RegExpr attribute="Key Points Operator" context="list-attribute-pre-inline" String=":(?=\s|$)" firstNonSpace="true" />
239
240 <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
241 <RegExpr attribute="Alias" context="#stay" String="&alias;" />
242 <RegExpr attribute="Reference" context="#stay" String="&reference;" />
243 <DetectChar attribute="String" context="string" char="'" beginRegion="String" />
244 <DetectChar attribute="String" context="stringx" char="&quot;" beginRegion="String" />
245
246 <DetectChar attribute="Operator" context="#pop!list" char="," />
247 <IncludeRules context="values-list" />
248 </context>
249
250 <!-- Hash -->
251 <context attribute="Hash" lineEndContext="#stay" name="hash" fallthrough="true" fallthroughContext="#pop!hash-element" noIndentationBasedFolding="true">
252 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
253 <DetectSpaces />
254 <DetectChar attribute="Operator" context="#pop!hash-element" char="?" />
255 </context>
256 <context attribute="Hash" lineEndContext="#stay" name="hash-element" noIndentationBasedFolding="true">
257 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
258 <DetectSpaces/>
259
260 <RegExpr attribute="Key" context="dpoints-hash-attribute-pre-inline" String="&dpointsHashAttrPreInline1;|&dpointsHashAttrPreInline2;|&dpointsHashAttrPreInline3;|&dpointsHashAttrPreInline4;"/>
261 <RegExpr attribute="Key Points Operator" context="hash-attribute-pre-inline" String=":(?=\s|$)"/>
262
263 <DetectChar attribute="Operator" context="#pop" char="}" endRegion="Hash" />
264 <DetectChar attribute="Operator" context="#pop!hash" char="," />
265
266 <!-- This improves highlighting in keys with multiple lines -->
267 <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
268 <RegExpr attribute="Alias" context="#stay" String="&alias;" />
269 <RegExpr attribute="Reference" context="#stay" String="&reference;" />
270 <DetectChar attribute="String" context="string" char="'" beginRegion="String" />
271 <DetectChar attribute="String" context="stringx" char="&quot;" beginRegion="String" />
272 </context>
273
274 <!-- Strings -->
275 <context attribute="String" lineEndContext="#stay" name="attribute-string" noIndentationBasedFolding="true">
276 <DetectIdentifier />
277 <IncludeRules context="escaped-char-singleq" />
278 <DetectChar attribute="String" context="attribute-end" char="'" endRegion="String" />
279 </context>
280
281 <context attribute="String" lineEndContext="#stay" name="attribute-stringx" noIndentationBasedFolding="true">
282 <DetectIdentifier />
283 <IncludeRules context="escaped-char-doubleq" />
284 <DetectChar attribute="String" context="attribute-end" char="&quot;" endRegion="String" />
285 </context>
286
287 <context attribute="String" lineEndContext="#stay" name="attribute-string-inline" noIndentationBasedFolding="true">
288 <DetectIdentifier />
289 <IncludeRules context="escaped-char-singleq" />
290 <DetectChar attribute="String" context="attribute-end-inline" char="'" endRegion="String" />
291 </context>
292
293 <context attribute="String" lineEndContext="#stay" name="attribute-stringx-inline" noIndentationBasedFolding="true">
294 <DetectIdentifier />
295 <IncludeRules context="escaped-char-doubleq" />
296 <DetectChar attribute="String" context="attribute-end-inline" char="&quot;" endRegion="String" />
297 </context>
298
299 <context attribute="Error" lineEndContext="#pop#pop#pop" name="attribute-end">
300 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
301 <DetectSpaces attribute="Normal Text" context="#stay"/>
302 </context>
303
304 <context attribute="Error" lineEndContext="#pop#pop#pop" name="attribute-end-inline">
305 <RegExpr attribute="Comment" context="comment" String="(?:^|\s+)#" />
306 <DetectSpaces attribute="Normal Text" context="#stay"/>
307 <AnyChar context="#pop#pop#pop" lookAhead="true" String="}],"/>
308 </context>
309
310 <context attribute="String" lineEndContext="#stay" name="string" noIndentationBasedFolding="true">
311 <DetectIdentifier />
312 <IncludeRules context="escaped-char-singleq" />
313 <DetectChar attribute="String" context="#pop" char="'" endRegion="String" />
314 </context>
315
316 <context attribute="String" lineEndContext="#stay" name="stringx" noIndentationBasedFolding="true">
317 <DetectIdentifier />
318 <IncludeRules context="escaped-char-doubleq" />
319 <DetectChar attribute="String" context="#pop" char="&quot;" endRegion="String" />
320 </context>
321
322 <context attribute="Normal Text" lineEndContext="#stay" name="escaped-char-doubleq">
323 <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})"/>
324 </context>
325
326 <context attribute="Normal Text" lineEndContext="#stay" name="escaped-char-singleq">
327 <Detect2Chars attribute="Escaped Character" context="#stay" char="'" char1="'" />
328 </context>
329
330 <context attribute="Comment" lineEndContext="#pop" name="comment">
331 <DetectSpaces />
332 <IncludeRules context="##Comments" />
333 </context>
334
335 <!-- Values -->
336 <context attribute="Normal Text" lineEndContext="#stay" name="values">
337 <RegExpr attribute="Null" context="#stay" String="&null;(?=&endValue;)"/>
338 <RegExpr attribute="Boolean" context="#stay" String="&bool;(?=&endValue;)"/>
339 <RegExpr attribute="Float" context="#stay" String="&allFloat;(?=&endValue;)"/>
340 <RegExpr attribute="Integer" context="#stay" String="&allInt;(?=&endValue;)"/>
341 </context>
342 <context attribute="Normal Text" lineEndContext="#stay" name="values-firstnonspace">
343 <RegExpr attribute="Null" firstNonSpace="true" context="#stay" String="&null;(?=&endValue;)"/>
344 <RegExpr attribute="Boolean" firstNonSpace="true" context="#stay" String="&bool;(?=&endValue;)"/>
345 <RegExpr attribute="Float" firstNonSpace="true" context="#stay" String="&allFloat;(?=&endValue;)"/>
346 <RegExpr attribute="Integer" firstNonSpace="true" context="#stay" String="&allInt;(?=&endValue;)"/>
347 </context>
348 <context attribute="Normal Text" lineEndContext="#stay" name="values-inline">
349 <RegExpr attribute="Null" context="#stay" String="&null;(?=&endValueInline;|&endValue;)"/>
350 <RegExpr attribute="Boolean" context="#stay" String="&bool;(?=&endValueInline;|&endValue;)"/>
351 <RegExpr attribute="Float" context="#stay" String="&allFloat;(?=&endValueInline;|&endValue;)"/>
352 <RegExpr attribute="Integer" context="#stay" String="&allInt;(?=&endValueInline;|&endValue;)"/>
353 </context>
354
355 <context attribute="Normal Text" lineEndContext="#stay" name="values-list">
356 <RegExpr attribute="Null" context="#stay" String="(?:\s|^)&null;(?=&endValueInline;|&endValue;)"/>
357 <RegExpr attribute="Boolean" context="#stay" String="(?:\s|^)&bool;(?=&endValueInline;|&endValue;)"/>
358 <RegExpr attribute="Float" context="#stay" String="(?:\s|^)&allFloat;(?=&endValueInline;|&endValue;)"/>
359 <RegExpr attribute="Integer" context="#stay" String="(?:\s|^)&allInt;(?=&endValueInline;|&endValue;)"/>
360 </context>
361 <!-- If the value is found immediately at the beginning of the list item -->
362 <context attribute="Normal Text" lineEndContext="#pop!list-element" name="find-values-list" fallthrough="true" fallthroughContext="#pop!list-element">
363 <RegExpr attribute="Null" context="#pop!list-element" String="&null;(?=&endValueInline;|&endValue;)"/>
364 <RegExpr attribute="Boolean" context="#pop!list-element" String="&bool;(?=&endValueInline;|&endValue;)"/>
365 <RegExpr attribute="Float" context="#pop!list-element" String="&allFloat;(?=&endValueInline;|&endValue;)"/>
366 <RegExpr attribute="Integer" context="#pop!list-element" String="&allInt;(?=&endValueInline;|&endValue;)"/>
367 </context>
368
369 <!-- Literal/Folded Style: http://yaml.org/spec/1.2/spec.html#id2795688 -->
370
371 <context attribute="Normal Text" lineEndContext="#stay" name="find-literal-block">
372 <!-- Do not allow indentation with tabs: -->
373 <RegExpr attribute="Alert" context="#stay" column="0"
374 String="^&space;*\t+\s*(?=(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|&lt;&gt;&quot;'])?&literalOp;&endValue;)" />
375
376 <!-- CASE 1: The literal/folded operator is the first character of a line.
377 The text after a space is considered literal.
378 Ex:
379 > |
380 > ^Start the literal text
381 -->
382 <RegExpr attribute="Literal/Folded Operator" context="literal-block-simple" column="0"
383 String="^&literalOp;(?=&endValue;)" beginRegion="Literal" />
384
385 <!-- CASE 2: Only the literal/folded operator is present in a line, after a space (the indentation
386 is captured). The text with the same indentation of the operator will be highlighted as literal.
387 Ex:
388 > key:
389 > |
390 > ^Start the literal text
391
392 However, in this case, the correct way is to use the indentation of the block, not the
393 indentation of the the operator. The problem is that it is difficult to capture.
394 > key1:
395 > key2:
396 > key3:
397 > |
398 > ^Block indentation (correct literal text)
399 -->
400 <RegExpr attribute="Literal/Folded Operator" context="literal-block-only-operator" column="0"
401 String="^(&space;+)&literalOp;(?=&endValue;)" beginRegion="Literal" />
402
403 <!-- CASE 3: There is a Key before the literal/folded operator (Key indentation is captured).
404 The text with the Key's indentation plus a space is considered literal.
405 Ex:
406 > key: |
407 > ^Start the literal text
408 > key: !!type >-
409 > ^Start the folded text
410 -->
411 <RegExpr attribute="Key Points Operator" context="literal-block-key" column="0"
412 String="^(&space;*)\:(?=\s+(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|&lt;&gt;&quot;'])?&literalOp;&endValue;)" />
413 <RegExpr attribute="Key" context="literal-block-key" column="0"
414 String="^(&space;*)(?:[^&quot;'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)(?=\:\s+(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|&lt;&gt;&quot;'])?&literalOp;&endValue;)" />
415
416 <!-- CASE 4: Is there an operator "?" or "-" at the beginning of the line.
417 NOTE: Nested characters "-" and "?" are considered as part of the indentation.
418 Therefore, the indentation of the Key or the last operator "?" or "-" is captured.
419 Ex:
420 > ? |
421 > ^Start the literal Text
422 > ? - - |
423 > ^Start the literal text
424 > - Key: |
425 > ^Start the literal text
426 > ? - - - - Key: |
427 > ^Start the literal text
428 -->
429 <RegExpr context="start-literal-block-withdash" lookAhead="true" column="0"
430 String="^&space;*(?:\?&space;*|\-&space;+){1,6}(?:(?:&keyDQ;|&keySQ;|[^#\-\?\s]|\-[^\s#])(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|&lt;&gt;&quot;'])?)?&literalOp;&endValue;" />
431
432 <!-- CASE 5: Literal/folded operator after a data type or other content.
433 Ex:
434 > !!type |
435 > ^Start the literal text
436 > key1:
437 > key2:
438 > !!type |
439 > ^Start the literal text
440 -->
441 <RegExpr context="start-literal-block-other" lookAhead="true" column="0"
442 String="^&space;*(?:(?:[&amp;\*]|!!)\S+\s+)+&literalOp;&endValue;" />
443 </context>
444
445 <!-- If the line with the literal operator starts with the "-" or "?" operator.
446 NOTE: The indentation capture is limited to 6 nested operators. -->
447 <context attribute="Normal Text" lineEndContext="#pop" name="start-literal-block-withdash" noIndentationBasedFolding="true">
448 <!-- With Key: Capture the Key indentation -->
449 <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s2" String="^(&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
450 <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s3" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
451 <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s4" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
452 <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s5" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
453 <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s6" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
454 <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s7" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/>
455 <!-- Without Key: Capture the indentation of the last operator "?" or "-" -->
456 <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s1" String="^(&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
457 <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s2" String="^(&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
458 <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s3" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
459 <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s4" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
460 <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s5" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
461 <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s6" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/>
462 </context>
463 <!-- Capture the indentation of data type, reference or alias -->
464 <context attribute="Normal Text" lineEndContext="#pop" name="start-literal-block-other" noIndentationBasedFolding="true">
465 <!-- The text with the same indentation will be considered literal -->
466 <RegExpr attribute="Data Types" context="#pop!literal-block-after-data" String="^(&space;+)&dataTypes;" column="0" />
467 <RegExpr attribute="Alias" context="#pop!literal-block-after-data" String="^(&space;+)&alias;" column="0" />
468 <RegExpr attribute="Reference" context="#pop!literal-block-after-data" String="^(&space;+)&reference;" column="0" />
469 <!-- The text after a space will be considered literal (empty text is captured) -->
470 <RegExpr attribute="Data Types" context="#pop!literal-block-withdash-s1" String="^()&dataTypes;" column="0" />
471 <RegExpr attribute="Alias" context="#pop!literal-block-withdash-s1" String="^()&alias;" column="0" />
472 <RegExpr attribute="Reference" context="#pop!literal-block-withdash-s1" String="^()&reference;" column="0" />
473 </context>
474
475 <!-- Highlight data/attribute before the literal operator (Note that if there is a line
476 break within a string or bracket, the literal line will not be highlighted). -->
477 <context attribute="Attribute" lineEndContext="#pop#pop" name="before-literal-operator" noIndentationBasedFolding="true">
478 <RegExpr attribute="Literal/Folded Operator" context="#pop!end-literal-operator" String="&literalOp;(?=&endValue;)" beginRegion="Literal" />
479
480 <RegExpr attribute="Error" context="#pop#pop" String="(?:[&amp;\*]|!!)\S*&literalOp;(?=&endValue;)" />
481 <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" />
482 <RegExpr attribute="Alias" context="#stay" String="&alias;" />
483 <RegExpr attribute="Reference" context="#stay" String="&reference;" />
484
485 <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" />
486 <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" />
487 <DetectChar attribute="String" context="string" char="'" beginRegion="String" />
488 <DetectChar attribute="String" context="stringx" char="&quot;" beginRegion="String" />
489 </context>
490
491 <context attribute="Normal Text" lineEndContext="#pop#pop" name="dpoints-key-before-literal-operator" fallthrough="true" fallthroughContext="#pop#pop" noIndentationBasedFolding="true">
492 <DetectChar attribute="Key Points Operator" context="#pop!key-before-literal-operator" char=":" />
493 </context>
494 <context attribute="Attribute" lineEndContext="#pop#pop" name="key-before-literal-operator" noIndentationBasedFolding="true">
495 <IncludeRules context="before-literal-operator" />
496 <DetectChar attribute="Operator" context="#stay" char="?" />
497 </context>
498 <context attribute="Attribute" lineEndContext="#pop" name="end-literal-operator" noIndentationBasedFolding="true">
499 <RegExpr attribute="Comment" context="#pop!comment" String="(?:^|\s+)#" />
500 </context>
501
502 <!-- Common rules for the content of the literal blocks -->
503 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-default" noIndentationBasedFolding="true">
504 <!-- End literal/folded block -->
505 <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
506 <!-- Find literal/folded operator -->
507 <RegExpr context="before-literal-operator" String="\S" lookAhead="true" />
508 </context>
509 <context attribute="Normal Text" lineEndContext="#pop" name="literal-block-key-default" noIndentationBasedFolding="true">
510 <!-- End literal/folded block -->
511 <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
512 <!-- Detect Key before the literal/folded operator -->
513 <RegExpr attribute="Key" context="dpoints-key-before-literal-operator" String="&keyAfterOp;(?=:\s)" />
514 <RegExpr attribute="Normal Text" context="#pop" String="\S" lookAhead="true" endRegion="Literal" />
515 </context>
516
517 <!-- Content of the literal block: -->
518
519 <!-- If the literal operator is starting the line (after a space, use block indentation) -->
520 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-only-operator" dynamic="true" noIndentationBasedFolding="true">
521 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1.*$" dynamic="true" column="0" />
522
523 <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
524 <RegExpr attribute="Comment" context="comment" String="(?:^|\s)#" />
525 <RegExpr context="#pop" String="\S" lookAhead="true" endRegion="Literal" />
526 </context>
527 <!-- If the literal operator is the first character of a line (or after header) -->
528 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-simple" noIndentationBasedFolding="true">
529 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^\s.*$" column="0" />
530
531 <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
532 <RegExpr attribute="Comment" context="comment" String="(?:^|\s)#" />
533 </context>
534 <!-- If there is a data type or other content before the liretal operator (use block indentation) -->
535 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-after-data" dynamic="true" noIndentationBasedFolding="true">
536 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1.*$" dynamic="true" column="0" />
537
538 <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
539 <RegExpr context="before-literal-operator" String="\S" lookAhead="true" />
540 </context>
541 <!-- If there is a key before the literal operator -->
542 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key" dynamic="true" noIndentationBasedFolding="true">
543 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1\s.*$" dynamic="true" column="0" />
544
545 <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" />
546 <!-- Attribute of the Key (the Key was previously highlighted) -->
547 <RegExpr attribute="Key Points Operator" context="key-before-literal-operator" String=":\s" />
548 <RegExpr context="key-before-literal-operator" String="\S" lookAhead="true" />
549 </context>
550
551 <!-- If there are dashes/"?" before the literal operator -->
552 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s1" dynamic="true" noIndentationBasedFolding="true">
553 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1\s.*$" dynamic="true" column="0" />
554 <IncludeRules context="literal-block-default" />
555 </context>
556 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s2" dynamic="true" noIndentationBasedFolding="true">
557 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2&space;\s.*$" dynamic="true" column="0" />
558 <IncludeRules context="literal-block-default" />
559 </context>
560 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s3" dynamic="true" noIndentationBasedFolding="true">
561 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3&space;{2}\s.*$" dynamic="true" column="0" />
562 <IncludeRules context="literal-block-default" />
563 </context>
564 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s4" dynamic="true" noIndentationBasedFolding="true">
565 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4&space;{3}\s.*$" dynamic="true" column="0" />
566 <IncludeRules context="literal-block-default" />
567 </context>
568 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s5" dynamic="true" noIndentationBasedFolding="true">
569 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5&space;{4}\s.*$" dynamic="true" column="0" />
570 <IncludeRules context="literal-block-default" />
571 </context>
572 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s6" dynamic="true" noIndentationBasedFolding="true">
573 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6&space;{5}\s.*$" dynamic="true" column="0" />
574 <IncludeRules context="literal-block-default" />
575 </context>
576 <!-- If there are dashes/"?" and a Key before the literal operator -->
577 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s2" dynamic="true" noIndentationBasedFolding="true">
578 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2&space;\s.*$" dynamic="true" column="0" />
579 <IncludeRules context="literal-block-key-default" />
580 </context>
581 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s3" dynamic="true" noIndentationBasedFolding="true">
582 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3&space;{2}\s.*$" dynamic="true" column="0" />
583 <IncludeRules context="literal-block-key-default" />
584 </context>
585 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s4" dynamic="true" noIndentationBasedFolding="true">
586 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4&space;{3}\s.*$" dynamic="true" column="0" />
587 <IncludeRules context="literal-block-key-default" />
588 </context>
589 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s5" dynamic="true" noIndentationBasedFolding="true">
590 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5&space;{4}\s.*$" dynamic="true" column="0" />
591 <IncludeRules context="literal-block-key-default" />
592 </context>
593 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s6" dynamic="true" noIndentationBasedFolding="true">
594 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6&space;{5}\s.*$" dynamic="true" column="0" />
595 <IncludeRules context="literal-block-key-default" />
596 </context>
597 <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s7" dynamic="true" noIndentationBasedFolding="true">
598 <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6%7&space;{6}\s.*$" dynamic="true" column="0" />
599 <IncludeRules context="literal-block-key-default" />
600 </context>
601 </contexts>
602
603 <itemDatas>
604 <itemData name="Normal Text" defStyleNum="dsAttribute" />
605 <itemData name="Attribute" defStyleNum="dsAttribute" />
606 <itemData name="List" defStyleNum="dsAttribute" />
607 <itemData name="Hash" defStyleNum="dsAttribute" />
608 <itemData name="Comment" defStyleNum="dsComment" />
609 <itemData name="End of Document" defStyleNum="dsComment" />
610 <itemData name="Document Header" defStyleNum="dsPreprocessor" />
611 <itemData name="Data Types" defStyleNum="dsOthers" />
612 <itemData name="Alias" defStyleNum="dsOthers" />
613 <itemData name="Reference" defStyleNum="dsOthers" />
614 <itemData name="Key" defStyleNum="dsFunction" bold="1" />
615 <itemData name="Directive" defStyleNum="dsPreprocessor" />
616 <itemData name="Key Points Operator" defStyleNum="dsKeyword" />
617 <itemData name="Operator" defStyleNum="dsKeyword" />
618 <itemData name="String" defStyleNum="dsString" />
619 <itemData name="Escaped Character" defStyleNum="dsSpecialChar" />
620 <itemData name="Literal/Folded Operator" defStyleNum="dsChar" bold="1" />
621 <itemData name="Literal/Folded Block" defStyleNum="dsNormal" />
622 <itemData name="Null" defStyleNum="dsChar" />
623 <itemData name="Boolean" defStyleNum="dsChar" />
624 <itemData name="Integer" defStyleNum="dsDecVal" />
625 <itemData name="Float" defStyleNum="dsFloat" />
626 <itemData name="Error" defStyleNum="dsError" />
627 <itemData name="Alert" defStyleNum="dsAlert" backgroundColor="#EF9A9A" />
628 </itemDatas>
629 </highlighting>
630
631 <general>
632 <folding indentationsensitive="1" />
633 <emptyLines>
634 <emptyLine regexpr="(?:\s+|\s*#.*)"/>
635 </emptyLines>
636 <comments>
637 <comment name="singleLine" start="#" position="afterwhitespace" />
638 </comments>
639 <keywords casesensitive="1"/>
640 </general>
641 </language>
642 <!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->