<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2011 The Open Source Research Group,
                   University of Erlangen-Nürnberg

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->

<!DOCTYPE language SYSTEM "language.dtd">
<language name="Rats!" version="1.00" kateversion="2.4" section="Sources" extensions="*.rats" author="Hannes Dohrn (hannes.dohrn@informatik.uni-erlangen.de)" license="The Apache Software License, Version 2.0">
  <highlighting>
    <list name="modifiers">
      <item>public</item>
      <item>protected</item>
      <item>private</item>
      <item>transient</item>
      <item>memoized</item>
      <item>inline</item>
      <item>noinline</item>
      <item>constant</item>
      <item>stateful</item>
    </list>
    <list name="options">
      <item>withLocation</item>
      <item>stateful</item>
      <item>resetting</item>
      <item>ignoringCase</item>
      <item>flatten</item>
      <item>variant</item>
      <item>withParseTree</item>
      <item>verbose</item>
      <item>nowarn</item>
      <item>parser</item>
      <item>factory</item>
      <item>visibility</item>
      <item>rawTypes</item>
      <item>main</item>
      <item>printer</item>
      <item>setOfString</item>
      <item>flag</item>
      <item>genericAsVoid</item>
      <item>dump</item>
      <item>explicit</item>
    </list>

    <contexts>
      <context name="Start" attribute="error" lineEndContext="#stay">
        <DetectSpaces />
        <IncludeRules context="Comment" />
        <StringDetect String="module" attribute="keyword" context="ModuleDecl" />
      </context>

      <context name="ModuleDecl" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <RegExpr attribute="dataType" context="#stay" String="[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)*" />
        <DetectChar char=";" attribute="delimiter" context="Dependency" />
      </context>

      <context name="Dependency" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <StringDetect String="modify" attribute="keyword" context="Modification" />
        <StringDetect String="instantiate" attribute="keyword" context="Instantiation" />
        <StringDetect String="import" attribute="keyword" context="Import" />
        <StringDetect String="header" attribute="keyword" context="Header" />
        <StringDetect String="body" attribute="keyword" context="Body" />
        <StringDetect String="footer" attribute="keyword" context="Footer" />
        <StringDetect String="option" attribute="keyword" context="Option" />
        <RegExpr String="." context="Production" attribute="normal" lookAhead="1" />
      </context>

      <context name="Modification" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <StringDetect String="as" attribute="keyword" context="#stay" />
        <RegExpr attribute="dataType" context="#stay" String="[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)*" />
        <AnyChar String="(,)" attribute="delimiter" context="#stay" />
        <DetectChar char=";" attribute="delimiter" context="#pop" />
      </context>
      <context name="Instantiation" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <StringDetect String="as" attribute="keyword" context="#stay" />
        <RegExpr attribute="dataType" context="#stay" String="[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)*" />
        <AnyChar String="(,)" attribute="delimiter" context="#stay" />
        <DetectChar char=";" attribute="delimiter" context="#pop" />
      </context>
      <context name="Import" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <StringDetect String="as" attribute="keyword" context="#stay" />
        <RegExpr attribute="dataType" context="#stay" String="[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)*" />
        <AnyChar String="(,)" attribute="delimiter" context="#stay" />
        <DetectChar char=";" attribute="delimiter" context="#pop" />
      </context>

      <context name="Header" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <DetectChar attribute="delimiter" context="JavaCode" char="{" beginRegion="javaCode" />
      </context>
      <context name="Body" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <DetectChar attribute="delimiter" context="JavaCode" char="{" beginRegion="javaCode" />
      </context>
      <context name="Footer" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <DetectChar attribute="delimiter" context="JavaCode" char="{" beginRegion="javaCode" />
      </context>

      <context name="Option" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <keyword String="options" attribute="keywordOption" context="#stay" />
        <DetectChar char="(" attribute="delimiter" context="AttributeValue" />
        <DetectChar char="," attribute="delimiter" context="#stay" />
        <DetectChar char=";" attribute="delimiter" context="Production" />
      </context>
      <context name="AttributeValue" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <HlCOct attribute="octal" context="#stay" />
        <HlCHex attribute="hex" context="#stay" />
        <Int attribute="decimal" context="#stay" />
        <RegExpr attribute="dataType" context="#stay" String="[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)*" />
        <DetectChar attribute="string" context="String" char="&quot;"/>
        <DetectChar char=")" attribute="delimiter" context="#pop" />
      </context>

      <context name="Production" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <keyword String="modifiers" attribute="keyword" context="#stay" />
        <RegExpr String="." context="Production2" attribute="normal" lookAhead="1" />
      </context>

      <context name="Production2" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <RegExpr attribute="identifier" context="Production3" String="[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)*" />
      </context>

      <context name="Production3" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />
        <RegExpr attribute="dataType" context="#stay" String="[a-zA-Z][a-zA-Z0-9]*" />
        <DetectChar char="=" attribute="delimiter" context="Choice" />
        <Detect2Chars char="+" char1="=" attribute="delimiter" context="Choice" />
        <Detect2Chars char="-" char1="=" attribute="delimiter" context="Choice" />
        <Detect2Chars char=":" char1="=" attribute="delimiter" context="Choice" />
      </context>

      <context name="Choice" attribute="error" lineEndContext="#stay">
        <DetectSpaces attribute="normal" />
        <IncludeRules context="Comment" />

        <StringDetect String="void" attribute="keyword" context="#stay" />
        <StringDetect String="null" attribute="keyword" context="#stay" />

        <HlCChar attribute="char" context="#stay"/>
        <RegExpr attribute="char" context="#stay" String="'\\u[0-9a-fA-F]{4}'"/>
        <DetectChar attribute="string" context="String" char="&quot;"/>

        <DetectChar char="[" attribute="delimiter" context="CharClass" />
        <AnyChar String=":()" attribute="delimiter" context="#stay" />
        <AnyChar String="*+?/!_&amp;" attribute="special" context="#stay" />

        <DetectChar attribute="delimiter" context="JavaCodePopOnce" char="{" beginRegion="javaCode" />
        <RegExpr attribute="dataType" context="#stay" String="[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)*" />

        <DetectChar char=";" attribute="delimiter" context="#pop#pop#pop" />
      </context>

      <context name="CharClass" attribute="error" context="#stay">
        <DetectChar attribute="keyword" context="CharClass2" char="^" />
        <RegExpr attribute="normal" context="CharClass2" String="." lookAhead="1" />
      </context>

      <context name="CharClass2" attribute="error" context="#stay">
        <RegExpr attribute="keyword" context="#stay" String="-" />
        <RegExpr attribute="stringChar" context="#stay" String="\\[btnfr&quot;'\-\[\]\\]" />
        <RegExpr attribute="stringChar" context="#stay" String="\\u[0-9a-fA-F]{4}"/>
        <RegExpr attribute="error" context="#stay" String="\\." />
        <DetectChar attribute="delimiter" context="#pop#pop" char="]" />
        <RegExpr attribute="string" context="#stay" String="." />
      </context>

      <context name="JavaCode" attribute="normal" lineEndContext="#stay">
        <IncludeRules context="Comment" />
        <DetectChar attribute="normal" context="OpenScope" char="{" />
        <DetectChar attribute="delimiter" context="#pop#pop" char="}" endRegion="javaCode" />
        <IncludeRules context="##Java" />
      </context>

      <context name="JavaCodePopOnce" attribute="normal" lineEndContext="#stay">
        <IncludeRules context="Comment" />
        <DetectChar attribute="normal" context="OpenScope" char="{" />
        <DetectChar attribute="delimiter" context="#pop" char="}" endRegion="javaCode" />
        <IncludeRules context="##Java" />
      </context>

      <context name="OpenScope" attribute="normal" lineEndContext="#stay">
        <IncludeRules context="Comment" />
        <DetectChar attribute="normal" context="OpenScope" char="{" />
        <DetectChar attribute="normal" context="#pop" char="}" />
        <IncludeRules context="##Java" />
      </context>

      <context attribute="string" lineEndContext="#pop" name="String">
        <LineContinue attribute="string" context="#stay"/>
        <HlCStringChar attribute="stringChar" context="#stay"/>
        <RegExpr attribute="stringChar" context="#stay" String="\\u[0-9a-fA-F]{4}"/>
        <DetectChar attribute="string" context="#pop" char="&quot;"/>
      </context>

      <context name="Comment" attribute="comment">
        <Detect2Chars attribute="comment" context="CommentStar" char="/" char1="*" />
        <Detect2Chars attribute="comment" context="CommentSlash" char="/" char1="/" />
      </context>
      <context name="CommentStar" attribute="comment" lineEndContext="#stay">
        <Detect2Chars attribute="comment" context="#pop" char="*" char1="/" />
      </context>
      <context name="CommentSlash" attribute="comment" lineEndContext="#pop">
      </context>
    </contexts>

    <itemDatas>
      <itemData name="normal" defStyleNum="dsNormal" />
      <itemData name="keyword" defStyleNum="dsKeyword" />
      <itemData name="dataType" defStyleNum="dsDataType" />
      <itemData name="decVal" defStyleNum="dsDecVal" />
      <itemData name="baseN" defStyleNum="dsBaseN" />
      <itemData name="float" defStyleNum="dsFloat" />
      <itemData name="char" defStyleNum="dsChar" />
      <itemData name="string" defStyleNum="dsString" />
      <itemData name="comment" defStyleNum="dsComment" />
      <itemData name="others" defStyleNum="dsOthers" />
      <itemData name="alert" defStyleNum="dsAlert" />
      <itemData name="function" defStyleNum="dsFunction" />
      <itemData name="regionMarker" defStyleNum="dsRegionMarker" />
      <itemData name="error" defStyleNum="dsError" />

      <!-- custom styles -->
      <itemData name="delimiter" defStyleNum="dsBaseN" bold="1" />
      <itemData name="stringChar" defStyleNum="dsChar" />
      <itemData name="keywordOption" defStyleNum="dsKeyword" color="#808000" selColor="#FFFFFF" bold="1" italic="0" />
      <itemData name="decimal" defStyleNum="dsDecVal" />
      <itemData name="octal" defStyleNum="dsBaseN" />
      <itemData name="hex" defStyleNum="dsBaseN" />
      <itemData name="identifier" defStyleNum="dsNormal" color="#0095FF" selColor="#FFFFFF" bold="1" italic="0" />
      <itemData name="special" defStyleNum="dsKeyword" color="#800080" selColor="#FFFFFF" bold="1" italic="0" />
    </itemDatas>
  </highlighting>

  <general>
    <comments>
      <comment name="multiLine" start="/*" end="*/" />
      <comment name="singleLine" start="//"/>
    </comments>
    <keywords casesensitive="1"/>
  </general>
</language>

<!-- kate: space-indent on; indent-width 2; replace-tabs on; -->
