Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add editor support file for some KDE Text Editors (KWrite, Kate, Quan…

…ta, etc.)

File comes from David Zaslavsky <dzaslavs@ellipsix.net> with no guarantees :)
  • Loading branch information...
commit 21121f5f3461e530076de041720d10c16cd95670 1 parent 9d39915
R. Tyler Ballance authored

Showing 1 changed file with 339 additions and 0 deletions. Show diff stats Hide diff stats

  1. +339 0 contrib/editors/kde-cheetah.xml
339 contrib/editors/kde-cheetah.xml
... ... @@ -0,0 +1,339 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE language SYSTEM "language.dtd"
  3 +[
  4 + <!ENTITY name "[A-Za-z_:][\w.:_-]*">
  5 + <!ENTITY ident "[A-Za-z_][A-Za-z_0-9]*">
  6 + <!ENTITY entref "&amp;(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
  7 + <!ENTITY block "block|def">
  8 + <!ENTITY idcmd "attr|del|encoding|errorCatcher|extends|implements|import|include(\s+raw)?|raise|shBang">
  9 +]>
  10 +<!--
  11 + This file is part of KDE's kate project.
  12 +
  13 + copyright : (C) 2008 by David Zaslavsky
  14 + email : dzaslavs@ellipsix.net
  15 +
  16 + This file is free software; you can redistribute it and/or modify
  17 + it under the terms of the GNU General Public License as published by
  18 + the Free Software Foundation; either version 2 of the License, or
  19 + (at your option) any later version.
  20 +-->
  21 +<!--
  22 + You'll find the "Writing a Kate Highlighting XML File HOWTO" at
  23 + http://kate.kde.org/doc/hlhowto.php
  24 + This is a template for the XML format used for syntax highlight descriptions
  25 + for the Kate text editor (http://kate.kde.org), which is part of the KDE
  26 + desktop environment (http://www.kde.org).
  27 +
  28 + Use it as the base for your own syntax files.
  29 +
  30 + Look at language.dtd for some documentation of the allowed elements and their attributes.
  31 + There is also a description of how to validate your syntax file.
  32 +
  33 + You'll find the "Writing a Kate Highlighting XML File HOWTO" at
  34 + http://kate.kde.org/doc/hlhowto.php
  35 + -->
  36 +
  37 +<language version="1.00" kateversion="2.4" name="Cheetah" section="Markup" extensions="*.tmpl" mimetype="text/plain" author="David Zaslavsky" licence="GPL">
  38 +<highlighting>
  39 + <list name="specialvars">
  40 + <item>None</item>
  41 + <item>False</item>
  42 + <item>True</item>
  43 + </list>
  44 + <contexts>
  45 + <context name="Start" attribute="Normal Text" lineEndContext="#stay">
  46 + <DetectSpaces/>
  47 + <IncludeRules context="FindCheetah"/>
  48 + <IncludeRules context="FindHTML"/>
  49 + </context>
  50 + <context name="FindCheetah" attribute="Normal Text" lineEndContext="#stay">
  51 + <RegExpr attribute="Comment" String="##.*$" context="#stay"/>
  52 + <Detect2Chars char="#" char1="*" attribute="Comment" context="LongComment" beginRegion="MLComment"/>
  53 + <RegExpr String="#raw\s*($|#)" attribute="Command" context="Raw"/>
  54 + <RegExpr String="#from\s+&ident;\s+import\s+&ident;\s*($|#)" attribute="Command" context="#stay"/>
  55 + <RegExpr String="#block\s+&ident;\s*($|#)" attribute="Command" context="#stay" beginRegion="block"/>
  56 + <RegExpr String="#def\s+&ident;\s*($|#)" attribute="Command" context="#stay" beginRegion="def"/>
  57 + <RegExpr String="#block\s+&ident;\s*\(" attribute="Command" context="Def Expression" beginRegion="block"/>
  58 + <RegExpr String="#def\s+&ident;\s*\(" attribute="Command" context="Def Expression" beginRegion="def"/>
  59 + <StringDetect String="#for" attribute="Command" context="For Expression" beginRegion="for"/>
  60 + <StringDetect String="#if" attribute="Command" context="If Expression" beginRegion="if"/>
  61 + <RegExpr String="#(else\s+if|elif)" attribute="Command" context="Expression" endRegion="if" beginRegion="if"/>
  62 + <StringDetect String="#repeat" attribute="Command" context="Expression" beginRegion="repeat"/>
  63 + <StringDetect String="#unless" attribute="Command" context="Expression" beginRegion="unless"/>
  64 + <StringDetect String="#while" attribute="Command" context="Expression" beginRegion="while"/>
  65 + <RegExpr String="#end block(\s+&ident;)?\s*($|#)" attribute="Command" context="#stay" endRegion="block"/>
  66 + <RegExpr String="#end def(\s+&ident;)?\s*($|#)" attribute="Command" context="#stay" endRegion="def"/>
  67 + <RegExpr String="#end for\s*($|#)" attribute="Command" context="#stay" endRegion="for"/>
  68 + <RegExpr String="#end if\s*($|#)" attribute="Command" context="#stay" endRegion="if"/>
  69 + <RegExpr String="#end repeat\s*($|#)" attribute="Command" context="#stay" endRegion="repeat"/>
  70 + <RegExpr String="#end unless\s*($|#)" attribute="Command" context="#stay" endRegion="unless"/>
  71 + <RegExpr String="#end while\s*($|#)" attribute="Command" context="#stay" endRegion="while"/>
  72 + <!-- short-form block directives -->
  73 + <RegExpr String="#(block|def) &ident;:" attribute="Command" context="Short Block Body"/>
  74 + <!-- no-argument directives -->
  75 + <RegExpr String="#(break|breakpoint|cache|compiler-settings|continue|finally|else|indent|pass|raw|slurp|stop|try)\s*($|#)" attribute="Command" context="#stay"/>
  76 + <!-- one-argument directives -->
  77 + <RegExpr String="#(attr|del|encoding|errorCatcher|extends|implements|import|include(\s+raw)?|shBang)\s+&ident;\s*($|#)" attribute="Command" context="#stay"/>
  78 + <!-- expression-argument directives -->
  79 + <RegExpr String="#(assert|echo|except|filter|raise|set|silent)" attribute="Command" context="Expression"/>
  80 + <StringDetect String="&lt;%" attribute="Element" context="Python"/>
  81 + <StringDetect String="&lt;%=" attribute="Element" context="Python"/>
  82 + <DetectChar char="$" attribute="Placeholder" context="Placeholder"/>
  83 + </context>
  84 + <context name="FindHTML" attribute="Normal Text" lineEndContext="#stay">
  85 + <DetectSpaces/>
  86 + <DetectIdentifier/>
  87 + <StringDetect attribute="Comment" context="HTMLComment" String="&lt;!--" beginRegion="HTMLComment" />
  88 + <StringDetect attribute="CDATA" context="CDATA" String="&lt;![CDATA[" beginRegion="cdata" />
  89 + <RegExpr attribute="Doctype" context="Doctype" String="&lt;!DOCTYPE\s+" beginRegion="doctype" />
  90 + <RegExpr attribute="Processing Instruction" context="PI" String="&lt;\?[\w:-]*" beginRegion="pi" />
  91 + <RegExpr attribute="Element" context="CSS" String="&lt;style\b" insensitive="TRUE" beginRegion="style" />
  92 + <RegExpr attribute="Element" context="JS" String="&lt;script\b" insensitive="TRUE" beginRegion="script" />
  93 + <RegExpr attribute="Element" context="El Open" String="&lt;pre\b" insensitive="TRUE" beginRegion="pre" />
  94 + <RegExpr attribute="Element" context="El Open" String="&lt;div\b" insensitive="TRUE" beginRegion="div" />
  95 + <RegExpr attribute="Element" context="El Open" String="&lt;table\b" insensitive="TRUE" beginRegion="table" />
  96 + <RegExpr attribute="Element" context="El Open" String="&lt;&name;" />
  97 + <RegExpr attribute="Element" context="El Close" String="&lt;/pre\b" insensitive="TRUE" endRegion="pre" />
  98 + <RegExpr attribute="Element" context="El Close" String="&lt;/div\b" insensitive="TRUE" endRegion="div" />
  99 + <RegExpr attribute="Element" context="El Close" String="&lt;/table\b" insensitive="TRUE" endRegion="table" />
  100 + <RegExpr attribute="Element" context="El Close" String="&lt;/&name;" />
  101 + <IncludeRules context="FindEntityRefs" />
  102 + </context>
  103 + <context name="Directive" attribute="Command" lineEndContext="#pop">
  104 + <DetectChar char="#" attribute="Command" context="#pop"/>
  105 + </context>
  106 + <context name="Expression" attribute="Command" lineEndContext="#pop">
  107 + <DetectChar char="#" attribute="Command" context="#pop"/>
  108 + <DetectChar char="$" attribute="Placeholder" context="Placeholder"/>
  109 + <RangeDetect char="'" char1="'" attribute="String" context="#stay"/>
  110 + <RangeDetect char="&quot;" char1="&quot;" attribute="String" context="#stay"/>
  111 + <keyword String="specialvars" attribute="Special Variable" context="#stay"/>
  112 + </context>
  113 + <context name="Def Expression" attribute="Command" lineEndContext="#pop">
  114 + <DetectChar char=")" attribute="Command" context="#stay"/>
  115 + <IncludeRules context="Expression"/>
  116 + </context>
  117 + <context name="For Expression" attribute="Command" lineEndContext="#pop">
  118 + <StringDetect String="in" attribute="Command" context="#stay"/>
  119 + <IncludeRules context="Expression"/>
  120 + </context>
  121 + <context name="If Expression" attribute="Command" lineEndContext="#pop">
  122 + <StringDetect String="then" attribute="Command" context="Then Clause" endRegion="if"/>
  123 + <IncludeRules context="Expression"/>
  124 + </context>
  125 + <context name="Then Clause" attribute="Normal Text" lineEndContext="#pop#pop">
  126 + <DetectChar char="#" attribute="Command" context="#pop#pop"/>
  127 + <StringDetect String="else" attribute="Command" context="#stay"/>
  128 + <keyword String="specialvars" attribute="Special Variable" context="#stay"/>
  129 + <DetectChar char="$" attribute="Placeholder" context="Placeholder"/>
  130 + <IncludeRules context="FindHTML"/>
  131 + </context>
  132 + <context name="Short Block Body" attribute="Normal Text" lineEndContext="#pop#pop">
  133 + <DetectChar char="#" attribute="Command" context="#pop#pop"/>
  134 + <DetectChar char="$" attribute="Placeholder" context="Placeholder"/>
  135 + <IncludeRules context="FindHTML"/>
  136 + </context>
  137 + <context name="Raw" attribute="Command" lineEndContext="Raw content">
  138 + <DetectChar char="#" attribute="Command" context="Raw content"/>
  139 + </context>
  140 + <context name="Raw content" attribute="Normal Text" lineEndContext="#stay">
  141 + <StringDetect String="#end raw" attribute="Command" context="#pop#pop#pop"/>
  142 + </context>
  143 + <context name="Placeholder" attribute="Placeholder" lineEndContext="#pop">
  144 + <RegExpr String="([[({])" attribute="Placeholder" context="Placeholder Brackets"/>
  145 + <RegExpr String="[A-Za-z_][A-Za-z_0-9]*" attribute="Placeholder" context="#stay"/>
  146 + <DetectChar char="." attribute="Placeholder" context="#stay"/>
  147 + <DetectSpaces attribute="Normal Text" context="#pop"/>
  148 + <RegExpr String="." context="#pop" lookAhead="true"/>
  149 + </context>
  150 + <context name="Placeholder Brackets" attribute="Placeholder" lineEndContext="#pop">
  151 + <RegExpr String="([[({])" attribute="Placeholder" context="Placeholder Brackets"/>
  152 + <DetectChar char="]" attribute="Placeholder" context="#pop"/>
  153 + <DetectChar char=")" attribute="Placeholder" context="#pop"/>
  154 + <DetectChar char="}" attribute="Placeholder" context="#pop"/>
  155 + <RangeDetect char="'" char1="'" attribute="String" context="#stay"/>
  156 + <RangeDetect char="&quot;" char1="&quot;" attribute="String" context="#stay"/>
  157 + <keyword String="specialvars" attribute="Special Variable" context="#stay"/>
  158 + <DetectChar char="#" attribute="Error" context="#stay"/>
  159 + </context>
  160 + <context name="ShortComment" attribute="Comment" lineEndContext="#pop">
  161 + <DetectSpaces/>
  162 + <IncludeRules context="##Alerts" />
  163 + </context>
  164 + <context name="LongComment" attribute="Comment" lineEndContext="#stay">
  165 + <DetectSpaces/>
  166 + <Detect2Chars char="*" char1="#" attribute="Comment" context="#pop" endRegion="MLComment"/>
  167 + <IncludeRules context="##Alerts" />
  168 + </context>
  169 + <context name="HTMLComment" attribute="Comment" lineEndContext="#stay">
  170 + <DetectSpaces/>
  171 + <IncludeRules context="FindCheetah"/>
  172 + <IncludeRules context="##Alerts"/>
  173 + <DetectIdentifier/>
  174 + <StringDetect attribute="Comment" context="#pop" String="--&gt;" endRegion="HTMLComment" />
  175 + <RegExpr attribute="Error" context="#stay" String="-(-(?!-&gt;))+" />
  176 + </context>
  177 + <context name="Python" attribute="Normal Text" lineEndContext="#stay">
  178 + <Detect2Chars char="%" char1="&gt;" attribute="Normal Text" context="#pop"/>
  179 + <IncludeRules context="##Python" includeAttrib="true"/>
  180 + </context>
  181 + <context name="FindEntityRefs" attribute="Normal Text" lineEndContext="#stay">
  182 + <IncludeRules context="FindCheetah"/>
  183 + <RegExpr attribute="EntityRef" context="#stay" String="&entref;" />
  184 + <AnyChar attribute="Error" context="#stay" String="&amp;&lt;" />
  185 + </context>
  186 + <context name="FindPEntityRefs" attribute="Normal Text" lineEndContext="#stay">
  187 + <IncludeRules context="FindCheetah"/>
  188 + <RegExpr attribute="EntityRef" context="#stay" String="&entref;" />
  189 + <RegExpr attribute="PEntityRef" context="#stay" String="%&name;;" />
  190 + <AnyChar attribute="Error" context="#stay" String="&amp;%" />
  191 + </context>
  192 + <context name="FindAttributes" attribute="Normal Text" lineEndContext="#stay">
  193 + <IncludeRules context="FindCheetah"/>
  194 + <RegExpr attribute="Attribute" context="#stay" String="&name;" column="0"/>
  195 + <RegExpr attribute="Attribute" context="#stay" String="\s+&name;" />
  196 + <DetectChar attribute="Attribute" context="Value" char="=" />
  197 + </context>
  198 + <context name="CDATA" attribute="Normal Text" lineEndContext="#stay">
  199 + <DetectSpaces/>
  200 + <DetectIdentifier/>
  201 + <IncludeRules context="FindCheetah"/>
  202 + <StringDetect attribute="CDATA" context="#pop" String="]]&gt;" endRegion="cdata" />
  203 + <StringDetect attribute="EntityRef" context="#stay" String="]]&amp;gt;" />
  204 + </context>
  205 + <context name="PI" attribute="Normal Text" lineEndContext="#stay">
  206 + <IncludeRules context="FindCheetah"/>
  207 + <Detect2Chars attribute="Processing Instruction" context="#pop" char="?" char1="&gt;" endRegion="pi" />
  208 + </context>
  209 + <context name="Doctype" attribute="Normal Text" lineEndContext="#stay">
  210 + <IncludeRules context="FindCheetah"/>
  211 + <DetectChar attribute="Doctype" context="#pop" char="&gt;" endRegion="doctype" />
  212 + <DetectChar attribute="Doctype" context="Doctype Internal Subset" char="[" beginRegion="int_subset" />
  213 + </context>
  214 + <context name="Doctype Internal Subset" attribute="Normal Text" lineEndContext="#stay">
  215 + <IncludeRules context="FindCheetah"/>
  216 + <DetectChar attribute="Doctype" context="#pop" char="]" endRegion="int_subset" />
  217 + <StringDetect attribute="Comment" context="LongComment" String="&lt;!--" beginRegion="MLComment" />
  218 + <RegExpr attribute="Processing Instruction" context="PI" String="&lt;\?[\w:-]*" beginRegion="pi" />
  219 + <IncludeRules context="FindPEntityRefs" />
  220 + </context>
  221 + <context name="Doctype Markupdecl" attribute="Normal Text" lineEndContext="#stay">
  222 + <IncludeRules context="FindCheetah"/>
  223 + <DetectChar attribute="Doctype" context="#pop" char="&gt;" />
  224 + <DetectChar attribute="Value" context="Doctype Markupdecl DQ" char="&quot;" />
  225 + <DetectChar attribute="Value" context="Doctype Markupdecl SQ" char="&apos;" />
  226 + </context>
  227 + <context name="Doctype Markupdecl DQ" attribute="Value" lineEndContext="#stay">
  228 + <IncludeRules context="FindCheetah"/>
  229 + <DetectChar attribute="Value" context="#pop" char="&quot;" />
  230 + <IncludeRules context="FindPEntityRefs" />
  231 + </context>
  232 + <context name="Doctype Markupdecl SQ" attribute="Value" lineEndContext="#stay">
  233 + <IncludeRules context="FindCheetah"/>
  234 + <DetectChar attribute="Value" context="#pop" char="&apos;" />
  235 + <IncludeRules context="FindPEntityRefs" />
  236 + </context>
  237 + <context name="El Open" attribute="Normal Text" lineEndContext="#stay">
  238 + <IncludeRules context="FindCheetah"/>
  239 + <Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" />
  240 + <DetectChar attribute="Element" context="#pop" char="&gt;" />
  241 + <IncludeRules context="FindAttributes" />
  242 + <RegExpr attribute="Error" context="#stay" String="\S" />
  243 + </context>
  244 + <context name="El Close" attribute="Normal Text" lineEndContext="#stay">
  245 + <IncludeRules context="FindCheetah"/>
  246 + <DetectChar attribute="Element" context="#pop" char="&gt;" />
  247 + <RegExpr attribute="Error" context="#stay" String="\S" />
  248 + </context>
  249 + <context name="El Close 2" attribute="Normal Text" lineEndContext="#stay">
  250 + <IncludeRules context="FindCheetah"/>
  251 + <DetectChar attribute="Element" context="#pop#pop#pop" char="&gt;" />
  252 + <RegExpr attribute="Error" context="#stay" String="\S" />
  253 + </context>
  254 + <context name="El Close 3" attribute="Normal Text" lineEndContext="#stay">
  255 + <IncludeRules context="FindCheetah"/>
  256 + <DetectChar attribute="Element" context="#pop#pop#pop#pop" char="&gt;" />
  257 + <RegExpr attribute="Error" context="#stay" String="\S" />
  258 + </context>
  259 + <context name="CSS" attribute="Normal Text" lineEndContext="#stay">
  260 + <IncludeRules context="FindCheetah"/>
  261 + <Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" endRegion="style" />
  262 + <DetectChar attribute="Element" context="CSS content" char="&gt;" />
  263 + <IncludeRules context="FindAttributes" />
  264 + <RegExpr attribute="Error" context="#stay" String="\S" />
  265 + </context>
  266 + <context name="CSS content" attribute="Normal Text" lineEndContext="#stay">
  267 + <IncludeRules context="FindCheetah"/>
  268 + <RegExpr attribute="Element" context="El Close 2" String="&lt;/style\b" insensitive="TRUE" endRegion="style" />
  269 + <IncludeRules context="##CSS" includeAttrib="true"/>
  270 + </context>
  271 + <context name="JS" attribute="Normal Text" lineEndContext="#stay">
  272 + <IncludeRules context="FindCheetah"/>
  273 + <Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" endRegion="script" />
  274 + <DetectChar attribute="Element" context="JS content" char="&gt;" />
  275 + <IncludeRules context="FindAttributes" />
  276 + <RegExpr attribute="Error" context="#stay" String="\S" />
  277 + </context>
  278 + <context name="JS content" attribute="Normal Text" lineEndContext="#stay">
  279 + <IncludeRules context="FindCheetah"/>
  280 + <RegExpr attribute="Element" context="El Close 2" String="&lt;/script\b" insensitive="TRUE" endRegion="script" />
  281 + <RegExpr attribute="Comment" context="JS comment close" String="//(?=.*&lt;/script\b)" insensitive="TRUE" />
  282 + <IncludeRules context="##JavaScript" includeAttrib="true"/>
  283 + </context>
  284 + <context name="JS comment close" attribute="Comment" lineEndContext="#pop">
  285 + <IncludeRules context="FindCheetah"/>
  286 + <RegExpr attribute="Element" context="El Close 3" String="&lt;/script\b" insensitive="TRUE" endRegion="script" />
  287 + <IncludeRules context="##Alerts" />
  288 + </context>
  289 + <context name="Value" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="Value NQ">
  290 + <IncludeRules context="FindCheetah"/>
  291 + <DetectChar attribute="Value" context="Value DQ" char="&quot;" />
  292 + <DetectChar attribute="Value" context="Value SQ" char="&apos;" />
  293 + <DetectSpaces />
  294 + </context>
  295 + <context name="Value NQ" attribute="Normal Text" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
  296 + <IncludeRules context="FindCheetah"/>
  297 + <IncludeRules context="FindEntityRefs" />
  298 + <RegExpr attribute="Value" context="#stay" String="/(?!&gt;)" />
  299 + <RegExpr attribute="Value" context="#stay" String="[^/&gt;&lt;&quot;&apos;\s]" />
  300 + </context>
  301 + <context name="Value DQ" attribute="Value" lineEndContext="#stay">
  302 + <IncludeRules context="FindCheetah"/>
  303 + <DetectChar attribute="Value" context="#pop#pop" char="&quot;" />
  304 + <IncludeRules context="FindEntityRefs" />
  305 + </context>
  306 + <context name="Value SQ" attribute="Value" lineEndContext="#stay">
  307 + <IncludeRules context="FindCheetah"/>
  308 + <DetectChar attribute="Value" context="#pop#pop" char="&apos;" />
  309 + <IncludeRules context="FindEntityRefs" />
  310 + </context>
  311 + </contexts>
  312 + <itemDatas>
  313 + <itemData name="Normal Text" defStyleNum="dsNormal"/>
  314 + <itemData name="Command" defStyleNum="dsFunction"/>
  315 + <itemData name="Comment" defStyleNum="dsComment"/>
  316 + <itemData name="String" defStyleNum="dsString"/>
  317 + <itemData name="Special Variable" defStyleNum="dsOthers"/>
  318 + <itemData name="Placeholder" defStyleNum="dsKeyword" color="#5555ff" selColor="#ffffff" bold="0" italic="0" />
  319 + <itemData name="CDATA" defStyleNum="dsBaseN" bold="1" />
  320 + <itemData name="Processing Instruction" defStyleNum="dsKeyword" />
  321 + <itemData name="Doctype" defStyleNum="dsDataType" bold="1" />
  322 + <itemData name="Element" defStyleNum="dsKeyword" />
  323 + <itemData name="Attribute" defStyleNum="dsOthers" />
  324 + <itemData name="Value" defStyleNum="dsString" color="#a00" />
  325 + <itemData name="EntityRef" defStyleNum="dsDecVal" />
  326 + <itemData name="PEntityRef" defStyleNum="dsDecVal" />
  327 + <itemData name="Error" defStyleNum="dsError" />
  328 + </itemDatas>
  329 +</highlighting>
  330 +<general>
  331 + <keywords casesensitive="1" additionalDeliminator="#"/>
  332 + <comments>
  333 + <comment name="singleLine" start="##"/>
  334 + <comment name="multiLine" start="#*" end="*#" region="MLComment"/>
  335 + <comment name="multiLine" start="&lt;!--" end="--&gt;" region="HTMLComment"/>
  336 + </comments>
  337 +</general>
  338 +</language>
  339 +<!-- kate: space-indent on; indent-width 4; replace-tabs on; indent-mode xml; -->

0 comments on commit 21121f5

Please sign in to comment.
Something went wrong with that request. Please try again.