You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdelibs/kate/data/julia.xml

288 lines
12 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!--
====================================================================
Julia syntax highlighting file for the TDE editors Kate and Kwrite
====================================================================
This was adapted from the Matlab syntax highlighting file
Most of this XML file is straightforward. Only the character ' (&apos;)
needs nontrivial treatment, since it is both a postfix operator indicating
complex conjugate transpose (adjoint) and a character delimiter. It is an
adjoint operator in the following positions:
1) immediately after an identifier (variable, function, but not keyword)
2) immediately after a number literal
3) immediately after the closing parenthesis ), ] and }
4) immediately after a simple transpose operator .'
5) immediately after another adjoint operator '
Otherwise it is a character delimiter.
This is implemented using look-ahead regexps. If one of the entities in the
above cases 1-4 (identifier, number literal, ...) matches and look-ahead
shows that it is followed by a ', the entity is highlighted and control is
passed to the special context _adjoint, whose sole purpose is to correctly
highlight a series of ' (thus covering case 5 as well). _adjoint immediately
returns to the default context _normal.
Author: Timothy E. Holy, Washington University in St. Louis
-->
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Julia" section="Sources" version="2-1" kateversion="2.4" extensions="*.jl" casesensitive="1" priority="5" license="MIT">
<highlighting>
<list name="block_begin">
<item>begin</item>
<item>do</item>
<item>for</item>
<item>function</item>
<item>if</item>
<item>let</item>
<item>quote</item>
<item>try</item>
<item>type</item>
<item>while</item>
</list>
<list name="block_eb">
<item>catch</item>
<item>else</item>
<item>elseif</item>
</list>
<list name="block_end">
<item>end</item>
</list>
<list name="keywords">
<item>abstract</item>
<item>bitstype</item>
<item>break</item>
<item>ccall</item>
<item>const</item>
<item>continue</item>
<item>export</item>
<item>global</item>
<item>import</item>
<item>in</item>
<item>local</item>
<item>macro</item>
<item>module</item>
<item>return</item>
<item>typealias</item>
</list>
<list name="types">
<item>AbstractArray</item>
<item>AbstractMatrix</item>
<item>AbstractVector</item>
<item>Any</item>
<item>Array</item>
<item>ASCIIString</item>
<item>Associative</item>
<item>Bool</item>
<item>ByteString</item>
<item>Char</item>
<item>Complex</item>
<item>Complex64</item>
<item>Complex128</item>
<item>ComplexPair</item>
<item>DArray</item>
<item>Dict</item>
<item>Exception</item>
<item>Expr</item>
<item>Float</item>
<item>Float32</item>
<item>Float64</item>
<item>Function</item>
<item>ObjectIdDict</item>
<item>Int</item>
<item>Int8</item>
<item>Int16</item>
<item>Int32</item>
<item>Int64</item>
<item>Integer</item>
<item>IntSet</item>
<item>IO</item>
<item>IOStream</item>
<item>Matrix</item>
<item>Nothing</item>
<item>None</item>
<item>NTuple</item>
<item>Number</item>
<item>Ptr</item>
<item>Range</item>
<item>Range1</item>
<item>Ranges</item>
<item>Rational</item>
<item>Real</item>
<item>Regex</item>
<item>RegexMatch</item>
<item>Set</item>
<item>Signed</item>
<item>StridedArray</item>
<item>StridedMatrix</item>
<item>StridedVecOrMat</item>
<item>StridedVector</item>
<item>String</item>
<item>SubArray</item>
<item>SubString</item>
<item>Symbol</item>
<item>Task</item>
<item>Tuple</item>
<item>Type</item>
<item>Uint</item>
<item>Uint8</item>
<item>Uint16</item>
<item>Uint32</item>
<item>Uint64</item>
<item>Union</item>
<item>Unsigned</item>
<item>UTF8String</item>
<item>VecOrMat</item>
<item>Vector</item>
<item>Void</item>
<item>WeakRef</item>
</list>
<contexts>
<context name="_normal" attribute="Normal Text" lineEndContext="#stay">
<DetectSpaces />
<!-- Blocks -->
<keyword context="#stay" attribute="Keyword" String="block_begin"
beginRegion="block" />
<keyword context="#stay" attribute="Keyword" String="block_eb"
endRegion="block" beginRegion="block" />
<keyword context="#stay" attribute="Keyword" String="block_end"
endRegion="block" />
<StringDetect String="#BEGIN" context="region_marker" attribute="FoldingComment" beginRegion="user_region" />
<StringDetect String="#END" context="region_marker" attribute="FoldingComment" endRegion="user_region" />
<!-- Keywords, types, and comments -->
<keyword context="#stay" attribute="Keyword" String="keywords" />
<keyword context="#stay" attribute="Data Type" String="types" />
<DetectChar char="#" context="1-comment" attribute="Comment"/>
<!-- Lists and arrays -->
<!-- <DetectChar char="(" context="nested" beginRegion="nested" attribute="Delimiter" />
<DetectChar char="[" context="squared" beginRegion="squared" attribute="Delimiter" />
<DetectChar char="{" context="curly" beginRegion="curly" attribute="Delimiter" /> -->
<!-- Strings -->
<DetectChar attribute="String" context="String" char="&quot;"/>
<!-- Multi-character operators -->
<StringDetect context="#stay" attribute="Operator" String="..."/>
<StringDetect context="#stay" attribute="Operator" String="::"/>
<StringDetect context="#stay" attribute="Operator" String="&gt;&gt;&gt;"/>
<StringDetect context="#stay" attribute="Operator" String="&gt;&gt;"/>
<StringDetect context="#stay" attribute="Operator" String="&lt;&lt;"/>
<StringDetect context="#stay" attribute="Operator" String="=="/>
<StringDetect context="#stay" attribute="Operator" String="!="/>
<StringDetect context="#stay" attribute="Operator" String="&lt;="/>
<StringDetect context="#stay" attribute="Operator" String="&gt;="/>
<StringDetect context="#stay" attribute="Operator" String="&amp;&amp;"/>
<StringDetect context="#stay" attribute="Operator" String="||"/>
<StringDetect context="#stay" attribute="Operator" String=".*"/>
<StringDetect context="#stay" attribute="Operator" String=".^"/>
<StringDetect context="#stay" attribute="Operator" String="./"/>
<StringDetect context="#stay" attribute="Operator" String=".'"/>
<StringDetect context="#stay" attribute="Operator" String="+="/>
<StringDetect context="#stay" attribute="Operator" String="-="/>
<StringDetect context="#stay" attribute="Operator" String="*="/>
<StringDetect context="#stay" attribute="Operator" String="/="/>
<StringDetect context="#stay" attribute="Operator" String="&amp;="/>
<StringDetect context="#stay" attribute="Operator" String="|="/>
<StringDetect context="#stay" attribute="Operator" String="$="/>
<StringDetect context="#stay" attribute="Operator" String="&gt;&gt;&gt;="/>
<StringDetect context="#stay" attribute="Operator" String="&gt;&gt;="/>
<StringDetect context="#stay" attribute="Operator" String="&lt;&lt;="/>
<!-- Look-ahead for adjoint ' after variable, number literal, closing braces and .' -->
<RegExpr context="_adjoint" attribute="Variable" String="[a-zA-Z]\w*(?=')" />
<RegExpr context="_adjoint" attribute="Float" String="(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?(im)?(?=')" />
<RegExpr context="_adjoint" attribute="Delimiter" String="[\)\]}](?=')" />
<RegExpr context="_adjoint" attribute="Operator" String="\.'(?=')" />
<!-- If ' is not the adjoint operator, it starts a character or an unterminated char -->
<RegExpr context="#stay" attribute="Char" String="'[^']*(''[^']*)*'(?=[^']|$)" />
<RegExpr context="#stay" attribute="Incomplete Char" String="'[^']*(''[^']*)*" />
<!-- Identifiers, numbers and braces -->
<!-- We can't use HlCHex, Int, and Float because we need to allow the "im" at the end of complex numbers -->
<DetectIdentifier context="#stay" attribute="Variable" />
<RegExpr context="#stay" attribute="Hex" String="0x[0-9a-fA-F]+(im)?" />
<RegExpr context="#stay" attribute="Float" String="(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?(im)?" />
<AnyChar context="#stay" attribute="Delimiter" String="()[]{}"/>
<!-- Single-character operators -->
<AnyChar context="#stay" attribute="Operator" String="*+-/\&amp;|&lt;&gt;~$!^=,;:@"/>
</context>
<!-- Context for user block (#BEGIN...#END) -->
<context name="region_marker" lineEndContext="#pop" attribute="FoldingComment" >
<IncludeRules context="1-comment" />
</context>
<!-- Contexts entered after beginning a list or array -->
<context name="nested" attribute="Normal Text" lineEndContext="#stay">
<DetectChar char=")" context="#pop" endRegion="nested" attribute="Delimiter" />
</context>
<context name="squared" attribute="Normal Text" lineEndContext="#stay">
<DetectChar char="]" context="#pop" endRegion="squared" attribute="Delimiter" />
</context>
<context name="curly" attribute="Normal Text" lineEndContext="#stay">
<DetectChar char="}" context="#pop" endRegion="curly" attribute="Delimiter" />
</context>
<!-- Context entered after encountering an ' adjoint operator -->
<context name="_adjoint" attribute="Operator" lineEndContext="#pop">
<RegExpr context="#pop" attribute="Operator" String="'+" />
</context>
<!-- Context entered after encountering an " (string) -->
<context attribute="String" lineEndContext="#pop" name="String">
<DetectSpaces />
<DetectIdentifier />
<LineContinue attribute="String" context="#stay"/>
<HlCStringChar attribute="String Char" context="#stay"/>
<DetectChar attribute="String" context="#pop" char="&quot;"/>
</context>
<!-- 1-line comment: #pop@EOL -->
<context name="1-comment" lineEndContext="#pop" attribute="Comment">
<DetectSpaces />
<DetectIdentifier />
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="Variable" defStyleNum="dsNormal" />
<itemData name="Operator" defStyleNum="dsNormal"/>
<itemData name="Decimal" defStyleNum="dsDecVal" />
<itemData name="Float" defStyleNum="dsFloat" />
<itemData name="Hex" defStyleNum="dsBaseN" />
<itemData name="Delimiter" defStyleNum="dsNormal" />
<itemData name="String" defStyleNum="dsString"/>
<itemData name="Char" defStyleNum="dsChar"/>
<itemData name="Incomplete Char" defStyleNum="dsChar"/>
<itemData name="System" defStyleNum="dsBaseN"/>
<itemData name="Keyword" defStyleNum="dsKeyword"/>
<itemData name="Data Type" defStyleNum="dsDataType"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="FoldingComment" defStyleNum="dsComment" />
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="#" />
</comments>
<keywords casesensitive="1" weakDeliminator=""/>
</general>
</language>