| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language> |
| 3 |
|
| 4 |
<!-- |
| 5 |
Improvements: |
| 6 |
|
| 7 |
- fixed typo: "lamba" is now "lambda" |
| 8 |
- added bind, func, typed, untyped, on, off |
| 9 |
- added multiline strings |
| 10 |
- added multiline comments (with stacking!) |
| 11 |
- added support for hex, binary, and octal numbers |
| 12 |
- added support for numerical literal suffixes (e.g. 'f64) |
| 13 |
- added triple-quote strings, raw strings and regex strings |
| 14 |
- made escape sequences in strings work slightly better (still needs work) |
| 15 |
- changed pragma syntax highlighting to dsAttribute instead of dsDataType |
| 16 |
- doc comments |
| 17 |
- TODO/BUG/FIXME/HACK/XXXX/NOTE comments |
| 18 |
|
| 19 |
--> |
| 20 |
|
| 21 |
<language |
| 22 |
name="Nim" |
| 23 |
version="4" |
| 24 |
kateversion="5.53" |
| 25 |
section="Sources" |
| 26 |
extensions="*.nim;*.nims;*.nimble" |
| 27 |
mimetype="text/x-nim" |
| 28 |
indenter="python" |
| 29 |
author="github.com/juancarlospaco" |
| 30 |
license="WTFPL"> |
| 31 |
|
| 32 |
<highlighting> |
| 33 |
<list name="keywords"> |
| 34 |
<item>const</item> |
| 35 |
<item>export</item> |
| 36 |
<item>import</item> |
| 37 |
<item>include</item> |
| 38 |
<item>lambda</item> |
| 39 |
<item>let</item> |
| 40 |
<item>var</item> |
| 41 |
</list> |
| 42 |
|
| 43 |
<list name="controls"> |
| 44 |
<item>assert</item> <!-- system --> |
| 45 |
<item>asm</item> |
| 46 |
<item>atomic</item> |
| 47 |
<item>block</item> |
| 48 |
<item>break</item> |
| 49 |
<item>case</item> |
| 50 |
<item>cast</item> |
| 51 |
<item>compiles</item> <!-- system --> |
| 52 |
<item>continue</item> |
| 53 |
<item>declared</item> <!-- system --> |
| 54 |
<item>declaredinscope</item> <!-- system --> |
| 55 |
<item>defined</item> <!-- system --> |
| 56 |
<item>discard</item> |
| 57 |
<item>do</item> |
| 58 |
<item>echo</item> <!-- system --> |
| 59 |
<item>elif</item> |
| 60 |
<item>else</item> |
| 61 |
<item>end</item> |
| 62 |
<item>except</item> |
| 63 |
<item>finally</item> |
| 64 |
<item>for</item> |
| 65 |
<item>from</item> |
| 66 |
<item>if</item> |
| 67 |
<item>mixin</item> |
| 68 |
<item>bind</item> |
| 69 |
<item>new</item> <!-- system --> |
| 70 |
<item>raise</item> |
| 71 |
<item>return</item> |
| 72 |
<item>sizeof</item> <!-- system --> |
| 73 |
<item>try</item> |
| 74 |
<item>when</item> |
| 75 |
<item>while</item> |
| 76 |
<item>quit</item> <!-- system --> |
| 77 |
<item>using</item> |
| 78 |
<item>yield</item> |
| 79 |
</list> |
| 80 |
|
| 81 |
<list name="operators"> |
| 82 |
<item>addr</item> |
| 83 |
<item>and</item> |
| 84 |
<item>as</item> |
| 85 |
<item>div</item> |
| 86 |
<item>in</item> |
| 87 |
<item>is</item> |
| 88 |
<item>isnot</item> |
| 89 |
<item>mod</item> |
| 90 |
<item>not</item> |
| 91 |
<item>notin</item> |
| 92 |
<item>of</item> |
| 93 |
<item>or</item> |
| 94 |
<item>shl</item> |
| 95 |
<item>shr</item> |
| 96 |
<item>xor</item> |
| 97 |
</list> |
| 98 |
|
| 99 |
<list name="types"> |
| 100 |
<item>array</item> |
| 101 |
<item>bool</item> |
| 102 |
<item>byte</item> |
| 103 |
<item>cchar</item> |
| 104 |
<item>cdouble</item> |
| 105 |
<item>char</item> |
| 106 |
<item>cfloat</item> |
| 107 |
<item>cint</item> |
| 108 |
<item>clong</item> |
| 109 |
<item>cshort</item> |
| 110 |
<item>cstring</item> |
| 111 |
<item>cuint</item> |
| 112 |
<item>distinct</item> |
| 113 |
<item>expr</item> |
| 114 |
<item>float</item> |
| 115 |
<item>float32</item> |
| 116 |
<item>float64</item> |
| 117 |
<item>generic</item> |
| 118 |
<item>int</item> |
| 119 |
<item>int8</item> |
| 120 |
<item>int16</item> |
| 121 |
<item>int32</item> |
| 122 |
<item>int64</item> |
| 123 |
<item>interface</item> |
| 124 |
<item>openarray</item> |
| 125 |
<item>pointer</item> |
| 126 |
<item>set</item> |
| 127 |
<item>seq</item> |
| 128 |
<item>stmt</item> |
| 129 |
<item>string</item> |
| 130 |
<item>tuple</item> |
| 131 |
<item>typedesc</item> |
| 132 |
<item>uint</item> |
| 133 |
<item>uint8</item> |
| 134 |
<item>uint16</item> |
| 135 |
<item>uint32</item> |
| 136 |
<item>uint64</item> |
| 137 |
<item>varargs</item> |
| 138 |
<item>void</item> |
| 139 |
<item>untyped</item> |
| 140 |
<item>typed</item> |
| 141 |
</list> |
| 142 |
|
| 143 |
<list name="attrs"> |
| 144 |
<item>out</item> |
| 145 |
<item>ptr</item> |
| 146 |
<item>ref</item> |
| 147 |
<item>shared</item> |
| 148 |
<item>static</item> |
| 149 |
</list> |
| 150 |
|
| 151 |
<list name="consts"> |
| 152 |
<item>false</item> |
| 153 |
<item>inf</item> |
| 154 |
<item>nil</item> |
| 155 |
<item>true</item> |
| 156 |
<item>on</item> |
| 157 |
<item>off</item> |
| 158 |
</list> |
| 159 |
|
| 160 |
<list name="others"> |
| 161 |
<item>result</item> |
| 162 |
</list> |
| 163 |
|
| 164 |
<list name="proctar"> |
| 165 |
<item>converter</item> |
| 166 |
<item>iterator</item> |
| 167 |
<item>macro</item> |
| 168 |
<item>method</item> |
| 169 |
<item>proc</item> |
| 170 |
<item>func</item> |
| 171 |
<item>template</item> |
| 172 |
</list> |
| 173 |
|
| 174 |
<list name="typetar"> |
| 175 |
<item>type</item> |
| 176 |
<item>concept</item> |
| 177 |
<item>object</item> |
| 178 |
<item>enum</item> |
| 179 |
</list> |
| 180 |
|
| 181 |
<contexts> |
| 182 |
<context name="Normal" attribute="Normal Text" lineEndContext="#stay"> |
| 183 |
<DetectSpaces/> |
| 184 |
<keyword context="#stay" attribute="Keywords" String="keywords"/> |
| 185 |
<keyword context="#stay" attribute="Controls" String="controls"/> |
| 186 |
<keyword context="#stay" attribute="Operators" String="operators"/> |
| 187 |
<keyword context="#stay" attribute="Types" String="types"/> |
| 188 |
<keyword context="#stay" attribute="Attrs" String="attrs"/> |
| 189 |
<keyword context="#stay" attribute="Others" String="others"/> |
| 190 |
<keyword context="#stay" attribute="Constants" String="consts"/> |
| 191 |
|
| 192 |
<keyword context="Start-Proctar" attribute="Keywords" String="proctar"/> |
| 193 |
<keyword context="Start-Typetar" attribute="Keywords" String="typetar"/> |
| 194 |
|
| 195 |
<StringDetect context="DocComment2" attribute="DocComment" String="##[" beginRegion="DocComment"/> |
| 196 |
<Detect2Chars context="DocComment1" attribute="DocComment" char="#" char1="#"/> |
| 197 |
<Detect2Chars context="Comment2" attribute="Comment" char="#" char1="[" beginRegion="Comment"/> |
| 198 |
<DetectChar context="Comment1" attribute="Comment" char="#"/> |
| 199 |
|
| 200 |
<StringDetect context="tripleq-string" attribute="String" String=""""" beginRegion="String"/> |
| 201 |
<DetectChar context="string" attribute="String" char=""" beginRegion="String"/> |
| 202 |
<StringDetect context="re-string" attribute="String" String="re"" beginRegion="String"/> |
| 203 |
<Detect2Chars context="raw-string" attribute="String" char="r" char1=""" beginRegion="String"/> |
| 204 |
|
| 205 |
<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]))?"/> |
| 206 |
<RegExpr context="#stay" attribute="Octal" String="0o[0-7][0-7_]*(?:'(?:(?:[ui](?:8|16|32|64))|(?:f(?:32|64|128))|[ufd]))?"/> |
| 207 |
<RegExpr context="#stay" attribute="Binary" String="0[bB][01][01_]*(?:'(?:(?:[ui](?:8|16|32|64))|(?:f(?:32|64|128))|[ufd]))?"/> |
| 208 |
<RegExpr context="#stay" attribute="Decimal" String="\b\d+(?=\.\.)"/> |
| 209 |
<Float context="#stay" attribute="Float"/> |
| 210 |
<Int context="#stay" attribute="Decimal"/> |
| 211 |
|
| 212 |
<RegExpr context="#stay" attribute="Types" String="\b_*[A-Z](?:\w|\._*[A-Z])*\b"/> |
| 213 |
<RegExpr context="#stay" attribute="Funcs" String="\b\w+\b\s*(?=(?:\[.*\]\w*)?(?:\(|(?:[ ](?![,+\-*/=!^&<>|?]|and|as|div|in|is|isnot|mod|notin|of|or|shl|shr|xor))))|\b\w+(?=")"/> |
| 214 |
|
| 215 |
<DetectIdentifier/> |
| 216 |
|
| 217 |
<Detect2Chars context="Pragmatar" attribute="Pragmas" char="{" char1="."/> |
| 218 |
<RegExpr context="Proptar" attribute="Brackets" String="\.(?!\d)"/> |
| 219 |
<RegExpr context="#stay" attribute="Float" String="\.(?=\d)"/> |
| 220 |
|
| 221 |
<AnyChar context="#stay" attribute="Brackets" String="()[]{},:;"/> |
| 222 |
<AnyChar context="#stay" attribute="Symbols" String="+-*/=!@$%^&<>|?"/> |
| 223 |
<HlCChar context="#stay" attribute="Char"/> |
| 224 |
</context> |
| 225 |
|
| 226 |
<context name="stringescape" attribute="String" lineEndContext="#stay"> |
| 227 |
<RegExpr attribute="String Char" String="\\["abfnrtv\\]" context="#stay"/> |
| 228 |
</context> |
| 229 |
|
| 230 |
<context name="string" attribute="String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 231 |
<IncludeRules context="stringescape"/> |
| 232 |
<DetectChar context="#pop" attribute="String" char=""" endRegion="String"/> |
| 233 |
</context> |
| 234 |
<context name="tripleq-string" attribute="String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 235 |
<StringDetect context="#pop" attribute="String" String=""""" endRegion="String"/> |
| 236 |
</context> |
| 237 |
<context name="raw-string" attribute="String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 238 |
<Detect2Chars context="#stay" attribute="String Char" char=""" char1="""/> |
| 239 |
<DetectChar context="#pop" attribute="String" char=""" endRegion="String"/> |
| 240 |
</context> |
| 241 |
<context name="re-string" attribute="String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 242 |
<DetectChar context="#pop" attribute="String" char=""" endRegion="String"/> |
| 243 |
<DetectChar context="#stay" attribute="String" char="/"/> <!-- Avoid closing string by JavaScript --> |
| 244 |
<IncludeRules context="Regular Expression##JavaScript"/> |
| 245 |
</context> |
| 246 |
|
| 247 |
<context name="Comment1" attribute="Comment" lineEndContext="#pop"> |
| 248 |
<LineContinue attribute="Comment" context="#stay"/> |
| 249 |
<IncludeRules context="##Comments"/> |
| 250 |
</context> |
| 251 |
|
| 252 |
<context name="DocComment1" attribute="DocComment" lineEndContext="#pop"> |
| 253 |
<LineContinue attribute="DocComment" context="#stay"/> |
| 254 |
</context> |
| 255 |
|
| 256 |
<context name="DocComment2" attribute="DocComment" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 257 |
<LineContinue attribute="DocComment" context="#stay"/> |
| 258 |
<StringDetect attribute="DocComment" context="DocComment2" String="##[" beginRegion="DocComment"/> |
| 259 |
<StringDetect attribute="DocComment" context="#pop" String="]##" endRegion="DocComment"/> |
| 260 |
</context> |
| 261 |
|
| 262 |
<context name="Comment2" attribute="Comment" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 263 |
<LineContinue attribute="Comment" context="#stay"/> |
| 264 |
<Detect2Chars attribute="Comment" context="Comment2" char="#" char1="[" beginRegion="Comment"/> |
| 265 |
<Detect2Chars attribute="Comment" context="#pop" char="]" char1="#" endRegion="Comment"/> |
| 266 |
<IncludeRules context="##Comments"/> |
| 267 |
</context> |
| 268 |
|
| 269 |
<context name="Start-Typetar" attribute="TypeDefs" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!Typetar"> |
| 270 |
<DetectSpaces context="#stay" attribute="Normal Text"/> |
| 271 |
</context> |
| 272 |
<context name="Typetar" attribute="TypeDefs" lineEndContext="#pop"> |
| 273 |
<DetectChar context="#stay" attribute="Brackets" char="."/> |
| 274 |
<DetectChar context="#pop" char="#" lookAhead="true"/> |
| 275 |
<DetectSpaces context="#pop" attribute="Normal Text"/> |
| 276 |
<AnyChar context="#pop" attribute="Brackets" String="()[]{},:;"/> |
| 277 |
<AnyChar context="#pop" attribute="Symbols" String="+-*/=!@$%^&<>"/> |
| 278 |
<keyword context="#pop" attribute="Operators" String="operators"/> |
| 279 |
</context> |
| 280 |
|
| 281 |
<context name="Start-Proctar" attribute="TypeDefs" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!Proctar"> |
| 282 |
<DetectSpaces context="#stay" attribute="Normal Text"/> |
| 283 |
</context> |
| 284 |
<context name="Proctar" attribute="ProcDefs" lineEndContext="#pop"> |
| 285 |
<DetectChar context="QuoteProctar" attribute="ProcDefs" char="`"/> |
| 286 |
<DetectChar context="#stay" attribute="Brackets" char="."/> |
| 287 |
<DetectChar context="#pop" char="#" lookAhead="true"/> |
| 288 |
<DetectSpaces context="#pop" attribute="Normal Text"/> |
| 289 |
<AnyChar context="#pop" attribute="Brackets" String="()[]{},:;"/> |
| 290 |
<AnyChar context="#pop" attribute="Symbols" String="+-*/=!@$%^&<>"/> |
| 291 |
</context> |
| 292 |
|
| 293 |
<context name="QuoteProctar" attribute="ProcDefs" lineEndContext="#pop"> |
| 294 |
<DetectChar context="#pop" attribute="ProcDefs" char="`"/> |
| 295 |
</context> |
| 296 |
|
| 297 |
<context name="Pragmatar" attribute="Pragmas" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 298 |
<Detect2Chars context="#pop" attribute="Pragmas" char="." char1="}"/> |
| 299 |
</context> |
| 300 |
|
| 301 |
<context name="Proptar" attribute="Props" lineEndContext="#pop"> |
| 302 |
<keyword context="#pop" attribute="Types" String="types"/> |
| 303 |
<RegExpr context="#pop" attribute="Types" String="_*[A-Z]\w*"/> |
| 304 |
<RegExpr context="#pop" attribute="Funcs" String="_*[a-z]\w*(?=\()"/> |
| 305 |
<RegExpr context="#pop" attribute="Props" String="_*[a-z]\w*"/> |
| 306 |
<RegExpr context="#pop" attribute="Brackets" String="\.+"/> |
| 307 |
</context> |
| 308 |
</contexts> |
| 309 |
|
| 310 |
<itemDatas> |
| 311 |
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/> |
| 312 |
<itemData name="Keywords" defStyleNum="dsKeyword" spellChecking="false"/> |
| 313 |
<itemData name="Controls" defStyleNum="dsControlFlow" spellChecking="false"/> |
| 314 |
<itemData name="Pragmas" defStyleNum="dsAttribute" spellChecking="false"/> |
| 315 |
<itemData name="Types" defStyleNum="dsAttribute" spellChecking="false"/> |
| 316 |
<itemData name="Props" defStyleNum="dsAttribute" spellChecking="false"/> |
| 317 |
<itemData name="Funcs" defStyleNum="dsFunction" spellChecking="false"/> |
| 318 |
<itemData name="Attrs" defStyleNum="dsDataType" spellChecking="false"/> |
| 319 |
<itemData name="Others" defStyleNum="dsOthers" spellChecking="false"/> |
| 320 |
<itemData name="Operators" defStyleNum="dsComment" spellChecking="false" bold="true" italic="false"/> |
| 321 |
<itemData name="Constants" defStyleNum="dsConstant" spellChecking="false" bold="true"/> |
| 322 |
|
| 323 |
<itemData name="TypeDefs" defStyleNum="dsDataType" spellChecking="false" bold="true"/> |
| 324 |
<itemData name="ProcDefs" defStyleNum="dsString" spellChecking="false" bold="true"/> |
| 325 |
|
| 326 |
<itemData name="Brackets" defStyleNum="dsKeyword" spellChecking="false"/> |
| 327 |
<itemData name="Symbols" defStyleNum="dsComment" spellChecking="false" italic="false"/> |
| 328 |
|
| 329 |
<itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/> |
| 330 |
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/> |
| 331 |
<itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false"/> |
| 332 |
<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/> |
| 333 |
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/> |
| 334 |
<itemData name="Char" defStyleNum="dsChar" spellChecking="false"/> |
| 335 |
<itemData name="String" defStyleNum="dsString" spellChecking="false"/> |
| 336 |
<itemData name="String Char" defStyleNum="dsSpecialChar" spellChecking="false"/> |
| 337 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 338 |
<itemData name="DocComment" defStyleNum="dsDocumentation" spellChecking="true"/> |
| 339 |
</itemDatas> |
| 340 |
</highlighting> |
| 341 |
|
| 342 |
<general> |
| 343 |
<comments> |
| 344 |
<comment name="singleLine" start="#" position="afterwhitespace"/> |
| 345 |
<comment name="multiLine" start="#[" end="]#" region="Comment"/> |
| 346 |
</comments> |
| 347 |
<folding indentationsensitive="true"/> |
| 348 |
<keywords casesensitive="0"/> |
| 349 |
</general> |
| 350 |
|
| 351 |
</language> |
| 352 |
<!-- kate: replace-tabs off; --> |