<?xml version="1.0" encoding="UTF-8"?>
<!--
  ====================================================================
  Julia syntax highlighting file for the KDE 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
[
  <!ENTITY int "[0-9]+(_[0-9]+)*">
  <!ENTITY hex "[0-9a-fA-F]+(_[0-9a-fA-F]+)*">
  <!ENTITY function_disallowed_chars "\s.,(){}\[\];:&#37;'&quot;&amp;$=/?\|^#@">
  <!ENTITY function_disallowed_first_char "0-9!&function_disallowed_chars;">
  <!ENTITY function_begin_boundary "(?:(?&lt;=[&function_disallowed_chars;!]|^)(?=[^&function_disallowed_first_char;]))">
]>

<language name="Julia" style="julia" indenter="julia" section="Sources" version="14" kateversion="5.62" extensions="*.jl" casesensitive="1" priority="5" license="MIT">

  <highlighting>
    <list name="cflow_begin">
      <item>for</item>
      <item>while</item>
      <item>if</item>
      <item>begin</item>
      <item>do</item>
    </list>
    <list name="cflow_eb">
      <item>else</item>
      <item>elseif</item>
      <item>try</item>
      <item>catch</item>
      <item>finally</item>
    </list>
    <list name="cflow">
      <item>break</item>
      <item>return</item>
      <item>continue</item>
    </list>
    <list name="block_begin">
      <item>function</item>
      <item>let</item>
      <item>quote</item>
      <item>type</item>
      <item>struct</item>
      <item>module</item>
      <item>baremodule</item>
      <item>macro</item>
    </list>
    <list name="block_end">
      <item>end</item>
    </list>
    <list name="keywords">
      <item>abstract</item>
      <item>bitstype</item>
      <item>ccall</item>
      <item>const</item>
      <item>export</item>
      <item>global</item>
      <item>in</item>
      <item>local</item>
      <item>macro</item>
      <item>module</item>
      <item>where</item>
      <item>new</item>
      <item>in</item>
      <item>struct</item>
      <item>ans</item>
      <!-- C Interface -->
      <item>ccall</item>
    </list>
    <list name="import_keywords">
      <item>import</item>
      <item>using</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>
      <!-- Essentials -->
      <item>Missing</item>
      <item>Cmd</item>
      <item>EnvDict</item>
      <item>VersionNumber</item>
      <item>ArgumentError</item>
      <item>AssertionError</item>
      <item>BoundsError</item>
      <item>CompositeException</item>
      <item>DimensionMismatch</item>
      <item>DivideError</item>
      <item>DomainError</item>
      <item>EOFError</item>
      <item>ErrorException</item>
      <item>InexactError</item>
      <item>InterruptException</item>
      <item>KeyError</item>
      <item>LoadError</item>
      <item>MethodError</item>
      <item>MissingException</item>
      <item>OutOfMemoryError</item>
      <item>ReadOnlyMemoryError</item>
      <item>OverflowError</item>
      <item>StackOverflowError</item>
      <item>SystemError</item>
      <item>TypeError</item>
      <item>UndefKeywordError</item>
      <item>UndefRefError</item>
      <item>UndefVarError</item>
      <item>StringIndexError</item>
      <item>InitError</item>
      <item>ExponentialBackOff</item>
      <item>Timer</item>
      <item>AsyncCondition</item>
      <item>ParseError</item>
      <!-- Collections and Data Structures -->
      <item>IteratorEltype</item>
      <item>AbstractRange</item>
      <item>OrdinalRange</item>
      <item>AbstractUnitRange</item>
      <item>StepRange</item>
      <item>UnitRange</item>
      <item>LinRange</item>
      <item>IdDict</item>
      <item>WeakKeyDict</item>
      <item>ImmutableDict</item>
      <item>BitSet</item>
      <item>Pair</item>
      <!-- Math -->
      <item>OneTo</item>
      <item>StepRangeLen</item>
      <item>RoundingMode</item>
      <!-- Numbers -->
      <item>AbstractFloat</item>
      <item>AbstractIrrational</item>
      <item>Float16</item>
      <item>Float32</item>
      <item>Float64</item>
      <item>BigFloat</item>
      <item>Int128</item>
      <item>UInt128</item>
      <item>BigInt</item>
      <item>ComplexF16</item>
      <item>ComplexF32</item>
      <item>ComplexF64</item>
      <item>Irrational</item>
      <item>UnionAll</item>
      <item>NamedTuple</item>
      <item>Val</item>
      <item>Vararg</item>
      <item>Some</item>
      <!-- String -->
      <item>AbstractChar</item>
      <item>SubstitutionString</item>
      <item>AbstractString</item>
      <!-- Array -->
      <item>UndefInitializer</item>
      <item>DenseArray</item>
      <item>DenseVector</item>
      <item>DenseMatrix</item>
      <item>BitArray</item>
      <item>IndexStyle</item>
      <item>IndexLinear</item>
      <item>IndexCartesian</item>
      <item>BroadcastStyle</item>
      <item>AbstractArrayStyle</item>
      <item>ArrayStyle</item>
      <item>DefaultArrayStyle</item>
      <item>Colon</item>
      <item>CartesianIndex</item>
      <item>CartesianIndices</item>
      <item>Dims</item>
      <item>LinearIndices</item>
      <item>PermutedDimsArray</item>
      <!-- Tasks -->
      <item>Condition</item>
      <item>Channel</item>
      <!-- Threads -->
      <item>Atomic</item>
      <item>AbstractLock</item>
      <item>ReentrantLock</item>
      <item>Mutex</item>
      <item>SpinLock</item>
      <item>RecursiveSpinLock</item>
      <item>Semaphore</item>
      <!-- Filesystem (Libc) -->
      <item>RawFD</item>
      <!-- I/O and Network -->
      <item>IOBuffer</item>
      <item>IOContext</item>
      <item>TextDisplay</item>
      <item>AbstractDisplay</item>
      <!-- Sort -->
      <item>PartialQuickSort</item>
      <!-- Iteration utilities -->
      <item>Stateful</item>
      <!-- Iterators -->
      <item>Pairs</item>
      <!-- C Interface -->
      <item>CFunction</item>
      <item>Ptr</item>
      <item>Ref</item>
      <item>Cchar</item>
      <item>Cuchar</item>
      <item>Cshort</item>
      <item>Cstring</item>
      <item>Cushort</item>
      <item>Cint</item>
      <item>Cuint</item>
      <item>Clong</item>
      <item>Culong</item>
      <item>Clonglong</item>
      <item>Culonglong</item>
      <item>Cintmax_t</item>
      <item>Cuintmax_t</item>
      <item>Csize_t</item>
      <item>Cssize_t</item>
      <item>Cptrdiff_t</item>
      <item>Cwchar_t</item>
      <item>Cwstring</item>
      <item>Cfloat</item>
      <item>Cdouble</item>
      <!-- C Standard Library -->
      <item>TmStruct</item>
      <!-- StackTraces -->
      <item>StackFrame</item>
      <item>StackTrace</item>
      <!-- Base64 -->
      <item>Base64EncodePipe</item>
      <item>Base64DecodePipe</item>
      <!-- Dates -->
      <item>Period</item>
      <item>CompoundPeriod</item>
      <item>Instant</item>
      <item>UTInstant</item>
      <item>TimeType</item>
      <item>DateTime</item>
      <item>Date</item>
      <item>Time</item>
      <item>DateFormat</item>
      <!-- Base.CoreLogging -->
      <item>LogLevel</item>
      <item>AbstractLogger</item>
      <item>NullLogger</item>
      <item>ConsoleLogger</item>
      <item>SimpleLogger</item>
      <!-- Mmap -->
      <item>Anonymous</item>
      <!-- Random -->
      <item>RandomDevice</item>
      <item>MersenneTwister</item>
      <!-- SharedArrays -->
      <item>SharedArray</item>
      <!-- Sockets -->
      <item>IPv4</item>
      <item>IPv6</item>
      <item>TCPSocket</item>
      <item>UDPSocket</item>
      <!-- SparseArrays -->
      <item>SparseVector</item>
      <item>SparseMatrixCSC</item>
      <!-- Others -->
      <item>AbstractChannel</item>
      <item>AbstractSet</item>
      <item>AbstractDict</item>
      <item>BitMatrix</item>
      <item>BitVector</item>
      <item>Enum</item>
      <item>CapturedException</item>
      <item>InvalidStateException</item>
      <item>ProcessFailedException</item>
    </list>

    <list name="constants">
      <!-- Constants -->
      <item>nothing</item>
      <item>PROGRAM_FILE</item>
      <item>ARGS</item>
      <item>C_NULL</item>
      <item>VERSION</item>
      <item>LOAD_PATH</item>
      <item>DEPOT_PATH</item>
      <!-- Sys -->
      <item>BINDIR</item>
      <item>CPU_THREADS</item>
      <item>WORD_SIZE</item>
      <item>KERNEL</item>
      <item>ARCH</item>
      <item>MACHINE</item>
      <!-- Essentials -->
      <item>missing</item>
      <item>devnull</item>
      <item>ENV</item>
      <!-- I/O and Network -->
      <item>stdout</item>
      <item>stderr</item>
      <item>stdin</item>
      <item>ENDIAN_BOM</item>
      <!-- Numbers -->
      <item>im</item>
      <item>pi</item>
      <item>&#960;</item>
      <item>e</item>
      <item>&#8495;</item>
      <item>catalan</item>
      <item>eulergamma</item>
      <item>&#611;</item>
      <item>golden</item>
      <item>&#966;</item>
      <item>Inf</item>
      <item>Inf64</item>
      <item>Inf32</item>
      <item>Inf16</item>
      <item>NaN</item>
      <item>NaN64</item>
      <item>NaN32</item>
      <item>NaN16</item>
      <!-- Math -->
      <item>RoundNearest</item>
      <item>RoundNearestTiesAway</item>
      <item>RoundNearestTiesUp</item>
      <item>RoundToZero</item>
      <item>RoundFromZero</item>
      <item>RoundUp</item>
      <item>RoundDown</item>
      <!-- Array -->
      <item>AbstractVecOrMat</item>
      <item>undef</item>
      <item>VecOrMat</item>
      <item>DenseVecOrMat</item>
      <item>StridedArray</item>
      <item>StridedVector</item>
      <item>StridedMatrix</item>
      <item>StridedVecOrMat</item>
      <!-- Sort -->
      <item>InsertionSort</item>
      <item>MergeSort</item>
      <item>QuickSort</item>
      <item>InsertionSort</item>
      <!-- Libc -->
      <item>MS_ASYNC</item>
      <item>MS_INVALIDATE</item>
      <item>MS_SYNC</item>
    </list>
    <list name="booleans">
      <item>true</item>
      <item>false</item>
    </list>
    <list name="modules">
      <item>Base</item>
      <item>Core</item>
      <item>Main</item>
      <item>Meta</item>
      <item>StackTraces</item>
      <item>Sys</item>
      <item>Libc</item>
      <item>Docs</item>
      <item>Threads</item>
      <item>Iterators</item>
      <item>Broadcast</item>
      <item>MathConstants</item>
      <item>Math</item>
      <item>Unicode</item>
      <item>Sort</item>
      <item>Artifacts</item>
      <item>Base64</item>
      <item>CRC32c</item>
      <item>Dates</item>
      <item>DelimitedFiles</item>
      <item>Distributed</item>
      <item>Downloads</item>
      <item>FileWatching</item>
      <item>Future</item>
      <item>InteractiveUtils</item>
      <item>LibGit2</item>
      <item>Libc</item>
      <item>Libdl</item>
      <item>LinearAlgebra</item>
      <item>Logging</item>
      <item>Mmap</item>
      <item>Pkg</item>
      <item>Printf</item>
      <item>Profile</item>
      <item>REPL</item>
      <item>Random</item>
      <item>SHA</item>
      <item>Serialization</item>
      <item>SharedArrays</item>
      <item>Sockets</item>
      <item>SparseArrays</item>
      <item>Statistics</item>
      <item>SuiteSparse</item>
      <item>TOML</item>
      <item>Test</item>
      <item>UUIDs</item>
      <item>CoreLogging</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="controlflow-block" attribute="Control Flow" String="cflow_begin"
                 beginRegion="block" />
        <keyword context="#stay" attribute="Control Flow" String="cflow"/>
        <WordDetect context="#stay" attribute="Keyword" String="end"
                    endRegion="block" />

        <IncludeRules context="coderoot"/>
      </context>

      <context name="subsetting" attribute="Normal Text" lineEndContext="#stay">
        <DetectSpaces attribute="Normal Text"/>
        <WordDetect context="#stay" attribute="Keyword" String="end"/>
        <IncludeRules context="coderoot"/>
        <DetectChar attribute="Normal Text" context="#pop" char="]"/>
      </context>

      <context name="coderoot" attribute="Normal Text" lineEndContext="#stay">
        <!-- functions have to be before built-in types to properly match constructors -->
        <RegExpr context="#stay" attribute="Function" String="&function_begin_boundary;[^&function_disallowed_first_char;][^&function_disallowed_chars;]*!?(?=\.?\()" />
        <RegExpr context="parametric-constructor" attribute="Function" String="&function_begin_boundary;[^&function_disallowed_first_char;][^&function_disallowed_chars;]*(?=\{.+\}.?\()" />

        <IncludeRules context="comment-rules"/>

        <!-- Keywords, types -->
        <RegExpr context="#stay" attribute="Keyword" String="\b(abstract|primitive)\s+type\b|\bmutable\s+struct\b" beginRegion="block"/>
        <keyword context="#stay" attribute="Keyword" String="keywords" />
        <keyword context="import" attribute="Import" String="import_keywords" />
        <keyword context="#stay" attribute="Data Type" String="types" />
        <keyword context="#stay" attribute="Boolean" String="booleans" />
        <keyword context="#stay" attribute="Constant" String="constants" />
        <keyword context="#stay" attribute="Module" String="modules" />

        <!-- Strings -->
        <StringDetect attribute="String" context="Block-String" String="&quot;&quot;&quot;" beginRegion="block-string"/>
        <DetectChar attribute="String" context="String" char="&quot;"/>
        <!-- Regular expressions -->
        <StringDetect attribute="String" context="Regex-Block-String" String="r&quot;&quot;&quot;" beginRegion="block-string"/>
        <Detect2Chars attribute="String" context="Regex-String" char="r" char1="&quot;"/>
        <!-- Byte Arrays -->
        <StringDetect attribute="String" context="Block-String" String="b&quot;&quot;&quot;" beginRegion="block-string"/>
        <Detect2Chars attribute="String" context="String" char="b" char1="&quot;"/>
        <!-- Version Number -->
        <Detect2Chars attribute="String" context="String" char="v" char1="&quot;"/>
        <!-- Raw Strings -->
        <StringDetect attribute="String" context="Raw-Block-String" String="raw&quot;&quot;&quot;" beginRegion="block-string"/>
        <StringDetect attribute="String" context="Raw-String" String="raw&quot;"/>
        <!-- Documentation -->
        <StringDetect attribute="String" context="Block-String" String="doc&quot;&quot;&quot;" beginRegion="block-string"/>
        <StringDetect attribute="String" context="String" String="doc&quot;"/>

        <!-- For Running External Programs -->
        <StringDetect attribute="Command String" context="Block-Backtick-String" String="```" beginRegion="block-string"/>
        <DetectChar attribute="Command String" context="Backtick-String" char="`"/>

        <!-- Subsetting. This is needed because the `end` keyword has a special meaning in subsetting operations and should not be used for folding -->
        <DetectChar attribute="Normal Text" context="subsetting" char="["/>

        <Detect2Chars context="type-annotation" attribute="Operator" char=":" char1=":"/>

        <!-- subtype operator -->
        <Detect2Chars context="type-annotation" attribute="Operator" char="&lt;" char1=":"/>

        <!-- Character operators
        this was generated semi-automatically using operators in https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm -->
        <RegExpr context="#stay" attribute="Operator" String="\.\.\.?|[:$]=?|\.?(?:&gt;&gt;&gt;=|&lt;--&gt;|//=|&lt;&lt;=|&gt;&gt;=|--&gt;|&lt;--|===|!==|&gt;&gt;&gt;|[-+*/\\^÷%|&amp;⊻]=|=&gt;|&amp;&amp;|\|\|?|&gt;=|&lt;=|==|!=|&lt;\||\|&gt;|\+\+|//|&lt;&lt;|&gt;&gt;|&lt;:|&gt;:|[\Q=≔⩴≕~←→↔↚↛↞↠↢↣↦↤↮⇎⇍⇏⇐⇒⇔⇴⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿⟵⟶⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤌⤍⤎⤏⤐⤑⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥊⥋⥎⥐⥒⥓⥖⥗⥚⥛⥞⥟⥢⥤⥦⥧⥨⥩⥪⥫⥬⥭⥰⧴⬱⬰⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌￩￫⇜⇝↜↝↩↪↫↬↼↽⇀⇁⇄⇆⇇⇉⇋⇌⇚⇛⇠⇢↷↶↺↻&gt;&lt;≥≤≡≠≢∈∉∋∌⊆⊈⊂⊄⊊∝∊∍∥∦∷∺∻∽∾≁≃≂≄≅≆≇≈≉≊≋≌≍≎≐≑≒≓≖≗≘≙≚≛≜≝≞≟≣≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊃⊅⊇⊉⊋⊏⊐⊑⊒⊜⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⋍⋐⋑⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⟈⟉⟒⦷⧀⧁⧡⧣⧤⧥⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫷⫸⫹⫺⊢⊣⟂⫪⫫…⁝⋮⋱⋰⋯+-−¦|⊕⊖⊞⊟∪∨⊔±∓∔∸≏⊎⊻⊽⋎⋓⧺⧻⨈⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨹⨺⩁⩂⩅⩊⩌⩏⩐⩒⩔⩖⩗⩛⩝⩡⩢⩣*/⌿÷%&amp;··⋅∘×\∩∧⊗⊘⊙⊚⊛⊠⊡⊓∗∙∤⅋≀⊼⋄⋆⋇⋉⋊⋋⋌⋏⋒⟑⦸⦼⦾⦿⧶⧷⨇⨰⨱⨲⨳⨴⨵⨶⨷⨸⨻⨼⨽⩀⩃⩄⩋⩍⩎⩑⩓⩕⩘⩚⩜⩞⩟⩠⫛⊍▷⨝⟕⟖⟗⨟^↑↓⇵⟰⟱⤈⤉⤊⤋⤒⤓⥉⥌⥍⥏⥑⥔⥕⥘⥙⥜⥝⥠⥡⥣⥥⥮⥯￪￬\E])" />

        <!-- Identifiers, numbers -->
        <!-- We can't use HlCHex, Int, and Float because we need to allow the "im" at the end of complex numbers -->
        <DetectIdentifier context="_adjoint" attribute="Variable" />
        <RegExpr context="_adjoint" attribute="Float" String="0x(&hex;\.?|(&hex;)?\.&hex;)[pP][+-]?[0-9]+(im)?"/>
        <RegExpr context="_adjoint" attribute="Hex" String="0x&hex;(im)?" />
        <RegExpr context="_adjoint" attribute="Octal" String="0o[0-7]+(_[0-7]+)*(im)?" />
        <RegExpr context="_adjoint" attribute="Binary" String="0b[01]+(_[01]+)*(im)?" />
        <RegExpr context="_adjoint" attribute="Float" String="(&int;(\.&int;)?|\.&int;)([eEfF][+-]?\d+)?(im)?" />

        <!-- 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="'[^']*(''[^']*)*" />

        <RegExpr context="#stay" attribute="Macro" String="@[a-zA-Z_]\w*" />
      </context>

      <!-- Context for user block (#BEGIN...#END) -->
      <context name="region_marker" lineEndContext="#pop" attribute="FoldingComment" >
        <IncludeRules context="1-comment" />
      </context>

      <!-- Context entered after encountering an identifier or a number -->
      <context name="_adjoint" attribute="Operator" lineEndContext="#pop" fallthroughContext="#pop">
        <DetectChar attribute="Operator" char="'" />
      </context>

      <!-- Context entered after encountering an " (string) -->
      <context attribute="String" lineEndContext="#pop" name="String">
        <DetectSpaces />
        <LineContinue attribute="String" context="#stay"/>
        <HlCStringChar attribute="String Char" context="#stay"/>
        <IncludeRules context="string-interpolation-rules"/>
        <DetectChar attribute="String" context="#pop" char="&quot;"/>
      </context>
      <context attribute="String" lineEndContext="#stay" name="Block-String">
        <DetectSpaces />
        <StringDetect attribute="String" context="#pop" String="&quot;&quot;&quot;" endRegion="block-string"/>
        <IncludeRules context="string-interpolation-rules"/>
        <HlCStringChar attribute="String Char" context="#stay"/>
      </context>
      <!-- Raw String -->
      <context attribute="String" lineEndContext="#pop" name="Raw-String">
        <DetectSpaces />
        <LineContinue attribute="String" context="#stay"/>
        <RegExpr attribute="String Char" context="#stay" String="(\\\\)*\\&quot;|(\\\\)+(?=&quot;)"/>
        <DetectChar attribute="String" context="#pop" char="&quot;"/>
      </context>
      <context attribute="String" lineEndContext="#stay" name="Raw-Block-String">
        <DetectSpaces />
        <StringDetect attribute="String" context="#pop" String="&quot;&quot;&quot;" endRegion="block-string"/>
      </context>
      <!-- Command String -->
      <context attribute="Command String" lineEndContext="#pop" name="Backtick-String">
        <DetectSpaces />
        <LineContinue attribute="Command String" context="#stay"/>
        <HlCStringChar attribute="String Char" context="#stay"/>
        <DetectChar attribute="Command String" context="#pop" char="`"/>
      </context>
      <context attribute="Command String" lineEndContext="#stay" name="Block-Backtick-String">
        <DetectSpaces />
        <StringDetect attribute="Command String" context="#pop" String="```" endRegion="block-string"/>
        <HlCStringChar attribute="String Char" context="#stay"/>
      </context>

      <!-- Regular expressions -->
      <context attribute="String" lineEndContext="#pop" name="Regex-String">
        <RegExpr attribute="String" context="#pop" String="&quot;[imsx]{1,4}"/>
        <Detect2Chars attribute="Char" context="Regex-Square-Bracket" char="[" char1="^"/>
        <DetectChar attribute="Char" context="Regex-Square-Bracket" char="["/>
        <IncludeRules context="Default-Regex"/>
        <IncludeRules context="String"/>
      </context>
      <context attribute="String" lineEndContext="#stay" name="Regex-Block-String">
        <RegExpr attribute="String" context="#pop" String="&quot;{3}[imsx]{1,4}" endRegion="block-string"/>
        <Detect2Chars attribute="Char" context="Block-Regex-Square-Bracket" char="[" char1="^"/>
        <DetectChar attribute="Char" context="Block-Regex-Square-Bracket" char="["/>
        <IncludeRules context="Default-Regex"/>
        <IncludeRules context="Block-String"/>
      </context>

      <context attribute="String" lineEndContext="#pop" name="Regex-Square-Bracket">
        <LineContinue attribute="String" context="#stay"/>
        <RegExpr attribute="String Char" context="#stay" String="\\." />
        <DetectChar attribute="Char" context="#pop" char="]"/>
        <DetectChar attribute="String" context="#pop" char="&quot;" lookAhead="true"/>
      </context>
      <context attribute="String" lineEndContext="#stay" name="Block-Regex-Square-Bracket">
        <RegExpr attribute="String Char" context="#stay" String="\\." />
        <DetectChar attribute="Char" context="#pop" char="]"/>
        <StringDetect attribute="String" context="#pop" String="&quot;&quot;&quot;" lookAhead="true"/>
      </context>
      <context attribute="String" lineEndContext="#stay" name="Default-Regex">
        <RegExpr attribute="String Char" context="#stay" String="\\." />
        <Detect2Chars attribute="Char" context="#stay" char="(" char1="?"/>
        <AnyChar attribute="Char" context="#stay" String="()|"/>
        <AnyChar attribute="String Char" context="#stay" String="?+*." />
      </context>

      <context name="string-interpolation-rules" lineEndContext="#stay" attribute="String">
        <Detect2Chars context="#stay" attribute="String" char="\" char1="$"/>
        <RegExpr context="string-interpolation" attribute="String Char" String="\$(?:\S)" lookAhead="true"/>
      </context>
      <context name="string-interpolation" lineEndContext="#stay" attribute="String">
        <DetectChar attribute="String Char" char="$"/>
        <DetectIdentifier attribute="Variable" context="#pop"/>
        <DetectChar char="(" context="string-interpolation-extended" attribute="Normal Text"/>
      </context>
      <context name="string-interpolation-extended" lineEndContext="#stay" attribute="Normal Text">
        <IncludeRules context="_normal"/>
        <DetectChar char="(" context="string-interpolation-internal" attribute="Normal Text"/>
        <DetectChar char=")" context="#pop#pop" attribute="Normal Text"/>
      </context>
      <context name="string-interpolation-internal" lineEndContext="#stay" attribute="Normal Text">
        <IncludeRules context="_normal"/>
        <DetectChar char="(" context="string-interpolation-internal" attribute="Normal Text"/>
        <DetectChar char=")" context="#pop" attribute="Normal Text"/>
      </context>

      <!-- 1-line comment: #pop@EOL  -->
      <context name="1-comment" lineEndContext="#pop" attribute="Comment">
        <DetectSpaces/>
        <IncludeRules context="##Comments"/>
        <DetectIdentifier/>
      </context>

      <context name="block-comment" lineEndContext="#stay" attribute="Comment">
        <Detect2Chars char="=" char1="#" context="#pop" attribute="Comment" endRegion="block-comment"/>
        <IncludeRules context="1-comment" />
      </context>
      <context name="controlflow-block" lineEndContext="#stay" attribute="Normal Text">
        <keyword context="#stay" attribute="Control Flow" String="cflow_eb" endRegion="block" beginRegion="block" />
        <WordDetect context="#pop" attribute="Control Flow" String="end" endRegion="block" />
        <IncludeRules context="_normal" />
      </context>
      <context name="parametric-type" lineEndContext="#stay" attribute="Data Type">
        <DetectChar char="{" context="parametric-type" attribute="Data Type"/>
        <DetectChar char="}" context="#pop" attribute="Data Type"/>
      </context>
      <context name="parametric-constructor" lineEndContext="#stay" attribute="Data Type">
        <DetectChar char="{" context="parametric-type" attribute="Data Type"/>
        <AnyChar String=",;()=:&gt;&lt;&amp;%*?[]^" attribute="Normal Text" context="#pop"/>
      </context>

      <!-- we have to allow spaces before the type, but switch to the parent context after the type -->
      <context name="type-annotation-internal" lineEndContext="#pop#pop" attribute="Data Type">
        <DetectChar char="{" context="parametric-type" attribute="Data Type"/>
        <AnyChar String=",;()=:&gt;&lt;&amp;%*?[]^}" context="#pop#pop" attribute="Normal Text"/>
        <DetectSpaces context="#pop#pop"/>
      </context>
      <context name="type-annotation" lineEndContext="#pop" attribute="Data Type">
        <DetectIdentifier context="type-annotation-internal" attribute="Data Type"/>
      </context>

      <!-- rules for comments, to be used by other contexts -->
      <context name="comment-rules" lineEndContext="#pop" attribute="Comment">
        <StringDetect String="#BEGIN" context="region_marker" attribute="FoldingComment" beginRegion="user_region" />
        <StringDetect String="#END" context="region_marker" attribute="FoldingComment" endRegion="user_region" />
        <Detect2Chars char="#" char1="=" context="block-comment" attribute="Comment" beginRegion="block-comment"/>
        <DetectChar char="#" context="1-comment" attribute="Comment"/>
      </context>

      <!-- context for imports -->
      <context name="import" lineEndContext="#stay" lineEmptyContext="#stay" attribute="Normal Text">
        <DetectSpaces attribute="Normal Text"/>
        <IncludeRules context="comment-rules"/>
        <RegExpr attribute="Module" context="import_list" String="[^:,\s]+"/>
      </context>
      <context name="import_list" lineEndContext="#pop#pop" attribute="Normal Text">
        <DetectSpaces attribute="Normal Text"/>
        <IncludeRules context="comment-rules"/>
        <DetectChar attribute="Normal Text" context="#pop" char=","/>
        <DetectChar attribute="Normal Text" context="#pop!import_vars" char=":"/>
      </context>
      <context name="import_vars" lineEndContext="#stay" lineEmptyContext="#stay" attribute="Normal Text">
        <DetectSpaces attribute="Normal Text"/>
        <IncludeRules context="comment-rules"/>
        <!-- we don't know if these are types, variables, or functions,
        so no highlighting here -->
        <RegExpr attribute="Normal Text" context="#stay" String="[^:,\s]+\s*(?=,)"/>
        <RegExpr attribute="Normal Text" context="#pop#pop" String="[^:,\s]+\s*(?![,:])"/>
      </context>
    </contexts>

    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal" />
      <itemData name="Variable" defStyleNum="dsNormal" />
      <itemData name="Operator" defStyleNum="dsOperator"/>
      <itemData name="Float" defStyleNum="dsFloat" />
      <itemData name="Hex" defStyleNum="dsBaseN" />
      <itemData name="Octal" defStyleNum="dsBaseN" />
      <itemData name="Binary" defStyleNum="dsBaseN" />
      <itemData name="String" defStyleNum="dsString"/>
      <itemData name="String Char" defStyleNum="dsSpecialChar"/>
      <itemData name="Char" defStyleNum="dsChar"/>
      <itemData name="Incomplete Char" defStyleNum="dsChar"/>
      <itemData name="Keyword" defStyleNum="dsKeyword"/>
      <itemData name="Import" defStyleNum="dsImport"/>
      <itemData name="Control Flow" defStyleNum="dsControlFlow" />
      <itemData name="Data Type" defStyleNum="dsDataType"/>
      <itemData name="Constant" defStyleNum="dsConstant"/>
      <itemData name="Boolean" defStyleNum="dsConstant"/>
      <itemData name="Macro" defStyleNum="dsPreprocessor"/>
      <itemData name="Module" defStyleNum="dsBuiltIn"/>
      <itemData name="Function" defStyleNum="dsFunction"/>
      <itemData name="Command String" defStyleNum="dsSpecialString"/>
      <itemData name="Comment" defStyleNum="dsComment"/>
      <itemData name="FoldingComment" defStyleNum="dsRegionMarker" />
    </itemDatas>

  </highlighting>

  <general>
    <comments>
      <comment name="singleLine" start="#" />
      <comment name="multiLine" start="#=" end="=#" region="block-comment" />
    </comments>
    <keywords casesensitive="1" weakDeliminator=""/>
  </general>

</language>

<!-- It's recommended to put the following line in the Variables field under Settings->Configure Kate->Open/Save->Modes&Filetypes -->
<!-- kate: space-indent on; indent-width 2; mixed-indent off; indent-mode cstyle; -->
