yaml.xml 41 KB

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