Syntax highlighting for KDE's Kate
Brian Huffman
bhuffman@galois.com
Mon, 6 May 2002 10:12:33 -0700
--------------Boundary-00=_X49PHIAFTJXN093X3ZJR
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
On Sunday 05 May 2002 02:42 pm, Jorge Adriano wrote:
> To bad the literate haskell mode doesn't work with the LaTeX kind of
> literate programming - \begin{code} ... \end{code} - that's how I've been
> coding all my haskell programs lately :)
Attached is my version of the haskell syntax highlighting file, hacked to work
with both styles of literate comments. It uses the #stay and #pop features
for changing contexts, so you probably need a recent version of Kate (I'm
using kde 3.0) for it to work. I hope you find it useful.
- Brian Huffman
--------------Boundary-00=_X49PHIAFTJXN093X3ZJR
Content-Type: text/xml;
charset="iso-8859-1";
name="lhs.xml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="lhs.xml"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Literate Haskell" version="1.00" kateversion="2.0" section="Sources" extensions="*.lhs" mimetype="text/x-literate-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="10" lineEndContext="#stay" name="Literate Comment">
<RegExpr attribute="10" context="2" String="^>"/>
<StringDetect attribute="10" context="1" String="\begin{code}"/>
</context>
<context attribute="10" lineEndContext="2" name="Code Block"/>
<context attribute="0" lineEndContext="#pop" name="Normal">
<StringDetect attribute="10" context="#pop#pop" String="\end{code}"/>
<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="-*[!#$%&*+./:<=>?@\\^|~]-*"/>
<Detect2Chars attribute="4" context="3" char="-" char1="-"/>
<Detect2Chars attribute="4" context="4" char="{" char1="-"/>
<DetectChar attribute="5" context="5" char="""/>
<RegExpr attribute="6" context="#stay" String="'[^'\\]'"/>
<RegExpr attribute="6" context="#stay" String="'\\[abfnrtv\"\'\\]'"/>
<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="4" 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\"\'\\&]"/>
<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="""/>
</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"/>
<itemData name="Lit Comment" defStyleNum="dsOthers"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="--"/>
<comment name="multiLine" start="{-" end="-}"/>
</comments>
<keywords casesensitive="1"/>
</general>
</language>
--------------Boundary-00=_X49PHIAFTJXN093X3ZJR--