<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="McStas" version="1.18" kateversion="2.3" section="Other" extensions="*.com;*.comp;*.instr" priority="5">
  <highlighting>
    <list name="keywords">
      <item> break </item>
      <item> case </item>
      <item> continue </item>
      <item> default </item>
      <item> do </item>
      <item> else </item>
      <item> enum </item>
      <item> extern </item>
      <item> for </item>
      <item> goto </item>
      <item> if </item>
      <item> inline </item>
      <item> return </item>
      <item> sizeof </item>
      <item> struct </item>
      <item> switch </item>
      <item> typedef </item>
      <item> union </item>
      <item> while </item>
    </list>
    <list name="mcstas_keywords">
      <item> DECLARE </item>
      <item> DEFINE </item>
      <item> END </item>
      <item> FINALLY </item>
      <item> INITIALIZE </item>
      <item> MCDISPLAY </item>
      <item> SAVE </item>
      <item> SHARE </item>
      <item> TRACE </item>
      <item> DEFINITION </item>
      <item> PARAMETERS </item>
      <item> POLARISATION </item>
      <item> SETTING </item>
      <item> STATE </item>
      <item> INSTRUMENT </item>
      <item> include </item>
    </list>
    <list name="mcstas_runtime">
      <item> ABSORB </item>
      <item> MC_GETPAR </item>
      <item> DETECTOR_OUT </item>
      <item> DETECTOR_OUT_0D </item>
      <item> DETECTOR_OUT_1D </item>
      <item> DETECTOR_OUT_2D </item>
      <item> DETECTOR_OUT_3D </item>
      <item> NAME_CURRENT_COMP </item>
      <item> INDEX_CURRENT_COMP </item>
      <item> POS_A_CURRENT_COMP </item>
      <item> POS_R_CURRENT_COMP </item>
      <item> ROT_A_CURRENT_COMP </item>
      <item> ROT_R_CURRENT_COMP </item>
      <item> RAD2MIN </item>
      <item> MIN2RAD </item>
      <item> DEG2RAD </item>
      <item> RAD2DEG </item>
      <item> K2V </item>
      <item> V2K </item>
      <item> Q2V </item>
      <item> V2Q </item>
      <item> SE2V </item>
      <item> VS2E </item>
      <item> FWHM2RMS </item>
      <item> RMS2FWHM </item>
      <item> HBAR </item>
      <item> MNEUTRON </item>
      <item> PI </item>
      <item> POS_A_COMP_INDEX </item>
      <item> POS_R_COMP_INDEX </item>
      <item> NAME_COMP </item>
      <item> POS_A_COMP </item>
      <item> POS_R_COMP </item>
      <item> ROT_A_COMP </item>
      <item> ROT_R_COMP </item>
      <item> SCATTER </item>
      <item> STORE_NEUTRON </item>
      <item> RESTORE_NEUTRON </item>
      <item> PROP_GRAV_DT </item>
      <item> PROP_DT </item>
      <item> PROP_Z0 </item>
      <item> PROP_X0 </item>
      <item> PROP_Y0 </item>
      <item> vec_prod </item>
      <item> scalar_prod </item>
      <item> NORM </item>
      <item> rotate </item>
      <item> rand01 </item>
      <item> randpm1 </item>
      <item> rand0max </item>
      <item> randminmax </item>
      <item> normal_vec </item>
      <item> box_intersect </item>
      <item> cylinder_intersect </item>
      <item> sphere_intersect </item>
      <item> randvec_target_circle </item>
      <item> randvec_target_rect_angular </item>
      <item> randvec_target_rect </item>
    </list>
    <list name="mcstas_trace">
      <item> ABSOLUTE </item>
      <item> AT </item>
      <item> COMPONENT </item>
      <item> EXTEND </item>
      <item> GROUP </item>
      <item> PREVIOUS </item>
      <item> RELATIVE </item>
      <item> ROTATED </item>
    </list>
    <list name="types">
      <item> auto </item>
      <item> char </item>
      <item> const </item>
      <item> double </item>
      <item> float </item>
      <item> int </item>
      <item> long </item>
      <item> register </item>
      <item> restrict </item>
      <item> short </item>
      <item> signed </item>
      <item> static </item>
      <item> unsigned </item>
      <item> void </item>
      <item> volatile </item>
      <item> _Imaginary </item>
      <item> _Complex </item>
      <item> _Bool </item>
    </list>
    <list name="attention">
      <item> FIXME </item>
      <item> TODO </item>
      <item> ### </item>
    </list>
    <contexts>
      <context attribute="Normal Text" lineEndContext="#stay" name="Normal">
        <keyword attribute="Keyword" context="#stay" String="keywords"/>
        <keyword attribute="McStas keywords" context="#stay" String="mcstas_keywords"/>
        <keyword attribute="McStas run-time" context="#stay" String="mcstas_runtime"/>
        <keyword attribute="McStas trace instrument" context="#stay" String="mcstas_trace"/>
        <keyword attribute="Data Type" context="#stay" String="types"/>
        <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1" />
        <DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1" />
        <Float attribute="Float" context="#stay">
          <AnyChar String="fF" attribute="Float" context="#stay"/>
        </Float>
        <HlCOct attribute="Octal" context="#stay"/>
        <HlCHex attribute="Hex" context="#stay"/>
        <Int attribute="Decimal" context="#stay" >
          <StringDetect attribute="Decimal" context="#stay" String="ULL" insensitive="TRUE"/>
          <StringDetect attribute="Decimal" context="#stay" String="LUL" insensitive="TRUE"/>
          <StringDetect attribute="Decimal" context="#stay" String="LLU" insensitive="TRUE"/>
          <StringDetect attribute="Decimal" context="#stay" String="UL" insensitive="TRUE"/>
          <StringDetect attribute="Decimal" context="#stay" String="LU" insensitive="TRUE"/>
          <StringDetect attribute="Decimal" context="#stay" String="LL" insensitive="TRUE"/>
          <StringDetect attribute="Decimal" context="#stay" String="U" insensitive="TRUE"/>
          <StringDetect attribute="Decimal" context="#stay" String="L" insensitive="TRUE"/>
        </Int>
        <HlCChar attribute="Char" context="#stay"/>
        <DetectChar attribute="String" context="String" char="&quot;"/>
        <IncludeRules context="##Doxygen" />
        <Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/"/>
        <Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
        <RegExpr attribute="Preprocessor" context="Outscoped" String="^\s*#\s*if\s+0" beginRegion="Outscoped"/>
        <RegExpr attribute="Preprocessor" context="Preprocessor" String="^\s*#"/>
        <RegExpr attribute="Function" context="#stay" String="\b[_\w][_\w\d]*(?=[\s]*[(])" />
        <RegExpr attribute="Symbol" context="Member" String="[.]{1,1}" />
        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/.*&lt;=&gt;?[]|~^&#59;"/>
      </context>
      <context attribute="String" lineEndContext="#pop" name="String">
        <LineContinue attribute="String" context="#stay"/>
        <HlCStringChar attribute="String Char" context="#stay"/>
        <DetectChar attribute="String" context="#pop" char="&quot;"/>
      </context>
      <context attribute="Normal Text" lineEndContext="#pop" name="Member" fallthrough="true" fallthroughContext="#pop">
        <RegExpr attribute="Function" context="#pop" String="\b[_\w][_\w\d]*(?=[\s]*)" />
      </context>
      <context attribute="Comment" lineEndContext="#pop" name="Commentar 1">
        <keyword attribute="Alert" context="#stay" String="attention" />
      </context>
      <context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
        <keyword attribute="Alert" context="#stay" String="attention" />
      </context>
      <context attribute="Preprocessor" lineEndContext="#pop" name="Preprocessor">
        <LineContinue attribute="Preprocessor" context="#stay"/>
        <RegExpr attribute="Preprocessor" context="Define" String="define.*((?=\\))"/>
        <RegExpr attribute="Preprocessor" context="#stay" String="define.*"/>
        <RangeDetect attribute="Prep. Lib" context="#stay" char="&quot;" char1="&quot;"/>
        <RangeDetect attribute="Prep. Lib" context="#stay" char="&lt;" char1="&gt;"/>
        <IncludeRules context="##Doxygen" />
        <Detect2Chars attribute="Comment" context="Commentar/Preprocessor" char="/" char1="*" beginRegion="Comment2"/>
      </context>
      <context attribute="Preprocessor" lineEndContext="#pop" name="Define">
        <LineContinue attribute="Preprocessor" context="#stay"/>
      </context>
      <context attribute="Comment" lineEndContext="#stay" name="Commentar/Preprocessor">
        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment2" />
      </context>
      <context attribute="Comment" lineEndContext="#stay" name="Outscoped" >
        <Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
        <keyword attribute="Alert" context="#stay" String="attention" />
        <RegExpr attribute="Comment" context="Outscoped intern" String="^\s*#\s*if" beginRegion="Outscoped"/>
        <RegExpr attribute="Preprocessor" context="#pop" String="^\s*#\s*(endif|else|elif)" endRegion="Outscoped"/>
      </context>
      <context attribute="Comment" lineEndContext="#stay" name="Outscoped intern">
        <Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
        <RegExpr attribute="Comment" context="Outscoped intern" String="^\s*#\s*if" beginRegion="Outscoped"/>
        <RegExpr attribute="Comment" context="#pop" String="^\s*#\s*endif" endRegion="Outscoped"/>
      </context>
    </contexts>
    <itemDatas>
      <itemData name="Normal Text"  defStyleNum="dsNormal"/>
      <itemData name="Keyword"      defStyleNum="dsKeyword"/>
      <itemData name="Function"     defStyleNum="dsFunction" bold="0"/>
      <itemData name="McStas keywords"   defStyleNum="dsKeyword" color="#0095ff" selColor="#ffffff" bold="1" italic="0"/>
      <itemData name="McStas run-time"   defStyleNum="dsKeyword" color="#0095ff" selColor="#ffffff" bold="0" italic="1"/>
      <itemData name="McStas trace instrument"   defStyleNum="dsKeyword" color="#0095ff" selColor="#ffffff" bold="1" italic="1"/>
      <itemData name="Data Type"    defStyleNum="dsDataType"/>
      <itemData name="Decimal"      defStyleNum="dsDecVal"/>
      <itemData name="Octal"        defStyleNum="dsBaseN"/>
      <itemData name="Hex"          defStyleNum="dsBaseN"/>
      <itemData name="Float"        defStyleNum="dsFloat"/>
      <itemData name="Char"         defStyleNum="dsChar"/>
      <itemData name="String"       defStyleNum="dsString"/>
      <itemData name="String Char"  defStyleNum="dsChar"/>
      <itemData name="Comment"      defStyleNum="dsComment"/>
      <itemData name="Symbol"       defStyleNum="dsNormal"/>
      <itemData name="Preprocessor" defStyleNum="dsOthers"/>
      <itemData name="Prep. Lib"    defStyleNum="dsOthers"/> <!--,Qt::darkYellow,Qt::yellow,false,false)); -->
      <itemData name="Alert"        defStyleNum="dsAlert" />
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="singleLine" start="//" />
      <comment name="multiLine" start="/*" end="*/" />
    </comments>
    <keywords casesensitive="1" />
  </general>
</language>
