<?xml version="1.0" encoding="UTF-8"?>
<!--
  Stan syntax definition for gridmicrotex.
  Written for this package, not derived from any third-party grammar.
  Block names, types and distributions follow the Stan reference manual.
-->
<language name="Stan" section="Scientific" extensions="*.stan"
          version="1" kateversion="5.0" casesensitive="1" license="MIT">
  <highlighting>
    <list name="blocks">
      <item>functions</item>
      <item>data</item>
      <item>transformed</item>
      <item>parameters</item>
      <item>model</item>
      <item>generated</item>
      <item>quantities</item>
    </list>
    <list name="controlflow">
      <item>if</item>
      <item>else</item>
      <item>for</item>
      <item>while</item>
      <item>break</item>
      <item>continue</item>
      <item>return</item>
      <item>in</item>
    </list>
    <list name="types">
      <item>int</item>
      <item>real</item>
      <item>complex</item>
      <item>vector</item>
      <item>row_vector</item>
      <item>matrix</item>
      <item>array</item>
      <item>simplex</item>
      <item>ordered</item>
      <item>positive_ordered</item>
      <item>unit_vector</item>
      <item>cholesky_factor_corr</item>
      <item>cholesky_factor_cov</item>
      <item>corr_matrix</item>
      <item>cov_matrix</item>
      <item>void</item>
      <item>tuple</item>
    </list>
    <list name="builtins">
      <item>normal</item>
      <item>std_normal</item>
      <item>lognormal</item>
      <item>cauchy</item>
      <item>student_t</item>
      <item>exponential</item>
      <item>gamma</item>
      <item>inv_gamma</item>
      <item>beta</item>
      <item>binomial</item>
      <item>bernoulli</item>
      <item>bernoulli_logit</item>
      <item>poisson</item>
      <item>poisson_log</item>
      <item>neg_binomial_2</item>
      <item>categorical</item>
      <item>dirichlet</item>
      <item>multi_normal</item>
      <item>uniform</item>
      <item>weibull</item>
      <item>target</item>
      <item>print</item>
      <item>reject</item>
    </list>
    <contexts>
      <context name="Normal" attribute="Normal Text" lineEndContext="#stay">
        <DetectSpaces attribute="Normal Text"/>
        <RegExpr attribute="Comment" String="//.*$"/>
        <RegExpr attribute="Comment" String="#.*$"/>
        <RegExpr attribute="Comment" String="/\*.*?\*/"/>
        <RegExpr attribute="String" String="&quot;(?:[^&quot;\\]|\\.)*&quot;"/>
        <keyword attribute="Control Flow" String="controlflow"/>
        <keyword attribute="Keyword" String="blocks"/>
        <keyword attribute="Data Type" String="types"/>
        <keyword attribute="Built-in" String="builtins"/>
        <RegExpr attribute="Float" String="\b[0-9]*\.[0-9]+(?:[eE][-+]?[0-9]+)?\b"/>
        <RegExpr attribute="Decimal" String="\b[0-9]+\b"/>
        <RegExpr attribute="Function" String="\b[A-Za-z_][A-Za-z0-9_]*(?=\s*\()"/>
        <!-- Last, so keywords and calls win. Consuming a whole
             identifier in one match keeps the scan off the
             per-character path. -->
        <DetectIdentifier attribute="Normal Text"/>
      </context>
    </contexts>
    <itemDatas>
      <itemData name="Normal Text"  defStyleNum="dsNormal"/>
      <itemData name="Comment"      defStyleNum="dsComment"/>
      <itemData name="String"       defStyleNum="dsString"/>
      <itemData name="Keyword"      defStyleNum="dsKeyword"/>
      <itemData name="Control Flow" defStyleNum="dsControlFlow"/>
      <itemData name="Data Type"    defStyleNum="dsDataType"/>
      <itemData name="Built-in"     defStyleNum="dsBuiltIn"/>
      <itemData name="Decimal"      defStyleNum="dsDecVal"/>
      <itemData name="Float"        defStyleNum="dsFloat"/>
      <itemData name="Function"     defStyleNum="dsFunction"/>
    </itemDatas>
  </highlighting>
</language>
