Syntax highlighting for KDE's Kate

Brian Huffman bhuffman@galois.com
Fri, 3 May 2002 10:29:44 -0700


--------------Boundary-00=_KXPJ98XKWX73HSTKAH1B
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

On Friday 03 May 2002 06:29 am, Ralf Hinze wrote:
> Dear KDE users,
>
> I've hacked syntax highlighting files for Kate, KDE's editor.
> Feel free to use or to modify them.
>
> 	http://www.informatik.uni-bonn.de/~ralf/software.html#syntax
>
> Cheers, Ralf

Attached here is another syntax highlighting file for Kate that I wrote; it 
closely follows the haskell report for things like character literals and the 
maximal-munch rule for comments. I haven't gotten around to writing a version 
for literate haskell files, but maybe someone else could try to adapt it. 

Feel free to try it out. Even if you don't use Kate for editing, you can still 
use the highlighting file with the embedded text viewer in Konqueror.

- Brian Huffman
--------------Boundary-00=_KXPJ98XKWX73HSTKAH1B
Content-Type: text/xml;
  charset="iso-8859-1";
  name="hs.xml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="hs.xml"

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Haskell" version="1.00" kateversion="2.0" section="Sources" extensions="*.hs" mimetype="text/x-haskell">
  <highlighting>
    <list name="reservedid">
      <item> case </item>
      <item> class </item>
      <item> data </item>
      <item> default </item>
      <item> deriving </item>
      <item> do </item>
      <item> else </item>
      <item> if </item>
      <item> import </item>
      <item> in </item>
      <item> infix </item>
      <item> infixl </item>
      <item> infixr </item>
      <item> instance </item>
      <item> let </item>
      <item> module </item>
      <item> newtype </item>
      <item> of </item>
      <item> primitive </item>
      <item> then </item>
      <item> type </item>
      <item> where </item>
    </list>
    <contexts>
      <context attribute="0" lineEndContext="#stay" name="Normal">
        <keyword attribute="1" context="#stay" String="reservedid"/>
        <RegExpr attribute="2" context="#stay" String="[A-Z][a-zA-Z0-9_']*"/>
        <RegExpr attribute="3" context="#stay" String="[a-z_][a-zA-Z0-9_']*"/>
        <RegExpr attribute="3" context="#stay" String="-*[!#$%&amp;*+./:&lt;=&gt;?@\\^|~]-*"/>
        <Detect2Chars attribute="4" context="1" char="-" char1="-"/>
        <Detect2Chars attribute="4" context="2" char="{" char1="-"/>
        <DetectChar attribute="5" context="3" char="&quot;"/>
        <RegExpr attribute="6" context="#stay" String="'[^'\\]'"/>
        <RegExpr attribute="6" context="#stay" String="'\\[abfnrtv\&quot;\'\\]'"/>
        <RegExpr attribute="6" context="#stay" String="'\\\^[A-Z@\[\]\\^_]'"/>
        <RegExpr attribute="6" context="#stay" String="'\\([0-9]+|o[0-7]+|x[0-9a-fA-F]+)'"/>
        <RegExpr attribute="6" context="#stay" String="'\\(S(OH?|UB|YN|TX|I|P)|E(NQ|OT|SC|TB|TX|M)|DC[1234]|[BFGRU]S|[BD]EL|ACK|CAN|CR|DLE|FF|FL|HT|NAK|NUL|VT)'"/>
        <RegExpr attribute="7" context="#stay" String="[0-9]+\.[0-9]+([eE][-+]?[0-9]+)?"/>
        <RegExpr attribute="8" context="#stay" String="0([oO][0-7]+|[xX][0-9a-fA-F]+)"/>
        <RegExpr attribute="9" context="#stay" String="[0-9]+"/>
      </context>
      <context attribute="4" lineEndContext="#pop" name="Comment 1"/>
      <context attribute="4" lineEndContext="#stay" name="Comment 2">
        <Detect2Chars attribute="4" context="2" char="{" char1="-"/>
        <Detect2Chars attribute="4" context="#pop" char="-" char1="}"/>
      </context>
      <context attribute="5" lineEndContext="#pop" name="String">
        <LineContinue attribute="6" context="#stay"/>
        <RegExpr attribute="6" context="#stay" String="\\[abfnrtv\&quot;\'\\&amp;]"/>
        <RegExpr attribute="6" context="#stay" String="\\\^[A-Z@\[\]\\^_]"/>
        <RegExpr attribute="6" context="#stay" String="\\([0-9]+|o[0-7]+|x[0-9a-fA-F]+)"/>
        <RegExpr attribute="6" context="#stay" String="\\(S(OH?|UB|YN|TX|I|P)|E(NQ|OT|SC|TB|TX|M)|DC[1234]|[BFGRU]S|[BD]EL|ACK|CAN|CR|DLE|FF|FL|HT|NAK|NUL|VT)"/>
        <DetectChar attribute="5" context="#pop" char="&quot;"/>
      </context>
    </contexts>
    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal"/>
      <itemData name="Keyword"     defStyleNum="dsKeyword"/>
      <itemData name="TyCon"       defStyleNum="dsDataType"/>
      <itemData name="Identifier"  defStyleNum="dsNormal"/>
      <itemData name="Comment"     defStyleNum="dsComment"/>
      <itemData name="String"      defStyleNum="dsString"/>
      <itemData name="Char"        defStyleNum="dsChar"/>
      <itemData name="Float"       defStyleNum="dsFloat"/>
      <itemData name="HexOctal"    defStyleNum="dsBaseN"/>
      <itemData name="Integer"     defStyleNum="dsDecVal"/>
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="singleLine" start="--"/>
      <comment name="multiLine" start="{-" end="-}"/>
    </comments>
    <keywords casesensitive="1"/>
  </general>
</language>

--------------Boundary-00=_KXPJ98XKWX73HSTKAH1B--