Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
319 lines (282 sloc) 12.6 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
Improvements:
- fixed typo: "lamba" is now "lambda"
- added bind, func, typed, untyped, on, off
- added multiline strings
- added multiline comments (with stacking!)
- added support for hex, binary, and octal numbers
- added support for numerical literal suffixes (e.g. 'f64)
- made escape sequences in strings work slightly better (still needs work)
- changed pragma syntax highlighting to dsAttribute instead of dsDataType
- doc comments
- added more context sensitivity, makes command syntax highlighting more consistent
- TODO/BUG/FIXME/HACK/XXXX/NOTE comments
- misc stuff
-->
<language
name="Nim"
version="1.0"
kateversion="2.4"
section="Sources"
extensions="*.nim"
mimetype="text/x-nim">
<highlighting>
<list name="keywords">
<item> const </item>
<item> export </item>
<item> import </item>
<item> include </item>
<item> lambda </item>
<item> let </item>
<item> var </item>
</list>
<list name="controls">
<item> assert </item> <!-- system -->
<item> asm </item>
<item> atomic </item>
<item> block </item>
<item> break </item>
<item> case </item>
<item> cast </item>
<item> compiles </item> <!-- system -->
<item> continue </item>
<item> declared </item> <!-- system -->
<item> declaredinscope </item> <!-- system -->
<item> defined </item> <!-- system -->
<item> discard </item>
<item> do </item>
<item> echo </item> <!-- system -->
<item> elif </item>
<item> else </item>
<item> end </item>
<item> except </item>
<item> finally </item>
<item> for </item>
<item> from </item>
<item> if </item>
<item> mixin </item>
<item> bind </item>
<item> new </item> <!-- system -->
<item> raise </item>
<item> return </item>
<item> sizeof </item> <!-- system -->
<item> try </item>
<item> when </item>
<item> while </item>
<item> quit </item> <!-- system -->
<item> using </item>
<item> yield </item>
</list>
<list name="operators">
<item> addr </item>
<item> and </item>
<item> as </item>
<item> div </item>
<item> in </item>
<item> is </item>
<item> isnot </item>
<item> mod </item>
<item> not </item>
<item> notin </item>
<item> of </item>
<item> or </item>
<item> shl </item>
<item> shr </item>
<item> xor </item>
</list>
<list name="types">
<item> array </item>
<item> bool </item>
<item> byte </item>
<item> cchar </item>
<item> cdouble </item>
<item> char </item>
<item> cfloat </item>
<item> cint </item>
<item> clong </item>
<item> cshort </item>
<item> cstring </item>
<item> cuint </item>
<item> distinct </item>
<item> expr </item>
<item> float </item>
<item> float32 </item>
<item> float64 </item>
<item> generic </item>
<item> range </item>
<item> int </item>
<item> int8 </item>
<item> int16 </item>
<item> int32 </item>
<item> int64 </item>
<item> interface </item>
<item> openarray </item>
<item> pointer </item>
<item> set </item>
<item> seq </item>
<item> stmt </item>
<item> string </item>
<item> tuple </item>
<item> typedesc </item>
<item> uint </item>
<item> uint8 </item>
<item> uint16 </item>
<item> uint32 </item>
<item> uint64 </item>
<item> varargs </item>
<item> void </item>
<item> untyped </item>
<item> typed </item>
</list>
<list name="attrs">
<item> out </item>
<item> ptr </item>
<item> ref </item>
<item> shared </item>
<item> static </item>
</list>
<list name="consts">
<item> false </item>
<item> inf </item>
<item> nil </item>
<item> true </item>
<item> on </item>
<item> off </item>
</list>
<list name="others">
<item> result </item>
</list>
<contexts>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<keyword context="#stay" attribute="Keywords" String="keywords"/>
<keyword context="#stay" attribute="Controls" String="controls"/>
<keyword context="#stay" attribute="Symbols" String="operators"/>
<keyword context="#stay" attribute="Types" String="types"/>
<keyword context="#stay" attribute="Attrs" String="attrs"/>
<keyword context="#stay" attribute="Others" String="others"/>
<keyword context="#stay" attribute="Float" String="consts"/>
<RegExpr context="Proctar" attribute="Keywords" String="\bconverter\b\s*"/>
<RegExpr context="Proctar" attribute="Keywords" String="\biterator\b\s*"/>
<RegExpr context="Proctar" attribute="Keywords" String="\bmacro\b\s*"/>
<RegExpr context="Proctar" attribute="Keywords" String="\bmethod\b\s*"/>
<RegExpr context="Proctar" attribute="Keywords" String="\bproc\b\s*"/>
<RegExpr context="Proctar" attribute="Keywords" String="\bfunc\b\s*"/>
<RegExpr context="Proctar" attribute="Keywords" String="\btemplate\b\s*"/>
<RegExpr context="Typetar" attribute="Keywords" String="\btype\b\s*"/>
<RegExpr context="Typetar" attribute="Keywords" String="\bconcept\b\s*"/>
<RegExpr context="Typetar" attribute="Keywords" String="\bobject\b\s*"/>
<RegExpr context="Typetar" attribute="Keywords" String="\benum\b\s*"/>
<RegExpr context="#stay" attribute="Hex" String="0[xX][0-9A-Fa-f][0-9A-Fa-f_]*('(([ui](8|16|32|64))|(f(32|64|128))|[ufd]))?"/>
<RegExpr context="#stay" attribute="Octal" String="0o[0-7][0-7_]*('(([ui](8|16|32|64))|(f(32|64|128))|[ufd]))?"/>
<RegExpr context="#stay" attribute="Binary" String="0[bB][01][01_]*('(([ui](8|16|32|64))|(f(32|64|128))|[ufd]))?"/>
<RegExpr context="#stay" attribute="Types" String="\b_*[A-Z](?:\w|\._*[A-Z])*\b"/>
<RegExpr context="#stay" attribute="Funcs" String="\b\w+\b\s*(?=(\[.*\]\w*)?([\(]|([ ](?![,+\-*/=!^&amp;&lt;&gt;|?]|and|as|div|in|is|isnot|mod|notin|of|or|shl|shr|xor))))"/>
<DetectIdentifier/>
<Detect2Chars context="Pragmatar" attribute="Pragmas" char="{" char1="."/>
<RegExpr context="Proptar" attribute="Brackets" String="\.(?!\d)"/>
<RegExpr context="#stay" attribute="Float" String="\.(?=\d)"/>
<AnyChar context="#stay" attribute="Brackets" String="()[]{},:;"/>
<AnyChar context="#stay" attribute="Symbols" String="+-*/=!@$%^&amp;&lt;&gt;|?"/>
<Int context="#stay" attribute="Decimal"/>
<HlCChar context="#stay" attribute="Char"/>
<DetectChar context="string" attribute="String" char="&quot;" beginRegion="String"/>
<RegExpr context="DocComment2" attribute="DocComment" String="##[[]"/>
<Detect2Chars context="DocComment1" attribute="DocComment" char="#" char1="#"/>
<Detect2Chars context="Comment2" attribute="Comment" char="#" char1="[" beginRegion="Comment"/>
<DetectChar context="Comment1" attribute="Comment" char="#"/>
</context>
<context name="stringescape" attribute="String Char" lineEndContext="#stay">
<RegExpr attribute="String Char" String="\\[&quot;abfnrtv]" context="#stay"/>
</context>
<context name="string" attribute="String" lineEndContext="#stay">
<IncludeRules context="stringescape"/>
<DetectChar context="#pop" attribute="String" char="&quot;" endRegion="String"/>
</context>
<context name="Comment1" attribute="Comment" lineEndContext="#pop">
<LineContinue attribute="Comment" context="#stay"/>
<RegExpr attribute="Alert" context="#stay" String="(BUG|XXXX|HACK)"/>
<RegExpr attribute="Warning" context="#stay" String="(TODO|FIXME)"/>
<RegExpr attribute="Info" context="#stay" String="(NOTE)"/>
</context>
<context name="DocComment1" attribute="DocComment" lineEndContext="#pop">
<LineContinue attribute="DocComment" context="#stay"/>
</context>
<context name="DocComment2" attribute="DocComment" lineEndContext="#stay">
<LineContinue attribute="DocComment" context="#stay"/>
<RegExpr attribute="DocComment" context="DocComment2" String="##[[]" beginRegion="DocComment"/>
<RegExpr attribute="DocComment" context="#pop" String="[]]##" endRegion="DocComment"/>
</context>
<context name="Comment2" attribute="Comment" lineEndContext="#stay">
<LineContinue attribute="Comment" context="#stay"/>
<RegExpr attribute="Alert" context="#stay" String="(BUG|XXXX|HACK)"/>
<RegExpr attribute="Warning" context="#stay" String="(TODO|FIXME)"/>
<RegExpr attribute="Info" context="#stay" String="(NOTE)"/>
<Detect2Chars attribute="Comment" context="Comment2" char="#" char1="[" beginRegion="Comment"/>
<Detect2Chars attribute="Comment" context="#pop" char="]" char1="#" endRegion="Comment"/>
</context>
<context name="Typetar" attribute="TypeDefs" lineEndContext="#pop">
<Detect2Chars context="Pragmatar" attribute="Pragmas" char="{" char1="."/>
<DetectChar context="#stay" attribute="Brackets" char="."/>
<AnyChar context="#pop" attribute="Brackets" String="()[]{},:;"/>
<AnyChar context="#pop" attribute="Symbols" String=" +-*/=!@$%^&amp;&lt;&gt;"/>
</context>
<context name="Proctar" attribute="ProcDefs" lineEndContext="#pop">
<DetectChar context="QuoteProctar" attribute="ProcDefs" char="`"/>
<DetectChar context="#stay" attribute="Brackets" char="."/>
<AnyChar context="#pop" attribute="Brackets" String="()[]{},:;"/>
<AnyChar context="#pop" attribute="Symbols" String=" +-*/=!@$%^&amp;&lt;&gt;"/>
</context>
<context name="QuoteProctar" attribute="ProcDefs" lineEndContext="#pop">
<DetectChar context="#pop" attribute="ProcDefs" char="`"/>
</context>
<context name="Pragmatar" attribute="Pragmas" lineEndContext="#stay">
<Detect2Chars context="#pop" attribute="Pragmas" char="." char1="}"/>
</context>
<context name="Proptar" attribute="Props" lineEndContext="#pop">
<keyword context="#pop" attribute="Types" String="types"/>
<RegExpr context="#pop" attribute="Types" String="_*[A-Z]\w*"/>
<RegExpr context="#pop" attribute="Funcs" String="_*[a-z]\w*(?=\()"/>
<RegExpr context="#pop" attribute="Props" String="_*[a-z]\w*(?=\.)"/>
<RegExpr context="#pop" attribute="Props" String="_*[a-z]\w*"/>
<RegExpr context="#pop" attribute="Brackets" String="\.+"/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/>
<itemData name="Keywords" defStyleNum="dsKeyword" spellChecking="false"/>
<itemData name="Controls" defStyleNum="dsDataType" spellChecking="false"/>
<itemData name="Pragmas" defStyleNum="dsAttribute" spellChecking="false"/>
<itemData name="Types" defStyleNum="dsDataType" spellChecking="false"/>
<itemData name="Props" defStyleNum="dsDataType" spellChecking="false"/>
<itemData name="Funcs" defStyleNum="dsDataType" spellChecking="false"/>
<itemData name="Attrs" defStyleNum="dsDataType" spellChecking="false"/>
<itemData name="Others" defStyleNum="dsOthers" spellChecking="false"/>
<itemData name="TypeDefs" defStyleNum="dsDataType" spellChecking="false" bold="true"/>
<itemData name="ProcDefs" defStyleNum="dsString" spellChecking="false" bold="true"/>
<itemData name="Brackets" defStyleNum="dsKeyword" spellChecking="false"/>
<itemData name="Symbols" defStyleNum="dsComment" spellChecking="false"/>
<itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/>
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
<itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false"/>
<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/>
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/>
<itemData name="Char" defStyleNum="dsChar" spellChecking="false"/>
<itemData name="String" defStyleNum="dsString" spellChecking="false"/>
<itemData name="Comment" defStyleNum="dsComment" spellChecking="false"/>
<itemData name="Alert" defStyleNum="dsAlert" spellChecking="false" bold="true"/>
<itemData name="Warning" defStyleNum="dsWarning" spellChecking="false" bold="true"/>
<itemData name="Info" defStyleNum="dsInformation" spellChecking="false" bold="true"/>
<itemData name="DocComment" defStyleNum="dsDocumentation" spellChecking="true"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="#" position="beforewhitespace"/>
</comments>
<folding indentationsensitive="true" />
<indentation mode="nimrod"/>
<keywords casesensitive="0"/>
</general>
</language>
You can’t perform that action at this time.