<?xml version="1.0" encoding="UTF-8"?>
<!-- Kate syntax highlighting for Objective Caml version 3.07 in the standard and revised syntaxes. -->
<!DOCTYPE language SYSTEM "language.dtd"
[
<!-- Regular expresion constants: -->
<!ENTITY LETTER "A-Za-z\0300-\0326\0330-\0366\0370-\0377">          <!-- Latin-1 letters. -->
<!ENTITY IDENT  "[&LETTER;_][&LETTER;0-9_']*">                      <!-- OCaml identifiers. -->
<!ENTITY MIDENT "[A-Z][&LETTER;0-9_']*">                            <!-- OCaml uppercase identifiers. -->
<!ENTITY ESC    "(\\[ntbr'&quot;\\]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2})"> <!-- OCaml character code escapes. -->
<!ENTITY DEC    "[0-9][0-9_]*">                                     <!-- Decimal digits with underscores. -->
]>
<language name="Objective Caml" version="1.05" kateversion="2.4" section="Sources" extensions="*.ml;*.mli" mimetype="" priority="10" author="Glyn Webster (glyn@wave.co.nz)" license="LGPL">

  <highlighting>
    <!-- Revised Syntax keywords are highlighted as identifiers by default. -->
    <!-- Change their highlighting colour to match the standard keywords    -->
    <!-- if you intend to use the Camlp4 Revised Syntax.                    -->
    <list name="revised syntax keywords">  
      <item> declare </item>
      <item> value </item>
      <item> where </item>
    </list>
    <list name="keywords">
      <item> and </item>
      <item> as </item>
      <item> assert </item>
      <item> asr </item>
<!--       <item> begin </item> -->
      <item> class </item>
      <item> closed </item>
      <item> constraint </item>
<!--       <item> do </item> -->
<!--       <item> done </item> -->
      <item> downto </item>
      <item> else </item>
<!--       <item> end </item> -->
      <item> exception </item>
      <item> external </item>
      <item> false </item>
      <item> for </item>
      <item> fun </item>
      <item> function </item>
      <item> functor </item>
      <item> if </item>
      <item> in </item>
<!--       <item> include </item> -->
      <item> inherit </item>
      <item> initializer </item>
      <item> land </item>
      <item> lazy </item>
      <item> let </item>
      <item> lor </item>
      <item> lsl </item>
      <item> lsr </item>
      <item> lxor </item>
      <item> match </item>
      <item> method </item>
      <item> mod </item>
<!--       <item> module </item> -->
      <item> mutable </item>
      <item> new </item>
<!--       <item> object </item> -->
      <item> of </item>
<!--       <item> open </item> -->
      <item> or </item>
      <item> parser </item>
      <item> private </item>
      <item> rec </item>
<!--       <item> sig </item> -->
<!--       <item> struct </item> -->
      <item> then </item>
      <item> to </item>
      <item> true </item>
      <item> try </item>
      <item> type </item>
      <item> val </item>
      <item> virtual </item>
      <item> when </item>
      <item> while </item>
      <item> with </item>
    </list>
    <list name="core types">
      <item> exn </item>
      <item> lazy_t </item>
      <item> format </item>
      <item> unit </item>
      <item> int </item>
      <item> real </item>
      <item> char </item>
      <item> string </item>
      <item> ref </item>
      <item> array </item>
      <item> bool </item>
      <item> list </item>
      <item> option </item>
    </list>
    <list name="symbols">
      <item> ? </item>
    </list>
    <list name="end">
      <item> end </item>
    </list>
    <list name="sig">
      <item> sig </item>
    </list>
    <list name="struct">
      <item> struct </item>
    </list>
    <list name="object">
      <item> object </item>
    </list>
    <list name="begin">
      <item> begin </item>
    </list>
    <list name="do">
      <item> do </item>
    </list>
    <list name="done">
      <item> done </item>
    </list>
    <list name="module_environment">
      <item> module </item>
      <item> open </item>
      <item> include </item>
    </list>
    <contexts>

      <context attribute="Normal Text" lineEndContext="#stay" name="Normal">

        <Detect2Chars attribute="Comment" context="Multiline Comment" char="(" char1="*" beginRegion="comment" />

        <DetectChar attribute="Symbol" context="#stay" char="(" beginRegion="paren"/>
        <DetectChar attribute="Symbol" context="#stay" char=")" endRegion="paren"/>

        <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="record"/>
        <DetectChar attribute="Symbol" context="#stay" char="}" endRegion="record"/>

        <Detect2Chars attribute="Symbol" context="#stay" char="[" char1="|" beginRegion="array"/>
        <Detect2Chars attribute="Symbol" context="#stay" char="|" char1="]" endRegion="array"/>
        <DetectChar attribute="Symbol" context="#stay" char="[" beginRegion="list"/>
        <DetectChar attribute="Symbol" context="#stay" char="]" endRegion="list"/>

        <keyword attribute="Keyword" context="#stay" String="do" beginRegion="loop"/>
        <keyword attribute="Keyword" context="#stay" String="done" endRegion="loop"/>
        <keyword attribute="Directive" context="ModuleEnv" String="module_environment"/>
        <keyword attribute="Region Marker" context="Block" String="begin" beginRegion="block"/>
        <keyword attribute="Region Marker" context="Object" String="object" beginRegion="object"/>
        <keyword attribute="Region Marker" context="Sig" String="sig" beginRegion="sig"/>
        <keyword attribute="Region Marker" context="Struct" String="struct" beginRegion="struct"/>

        <RegExpr attribute="Constructor" context="#stay" String="`\s*&IDENT;"/>
        <RegExpr attribute="Module" lookAhead="true" context="ModuleEnv2" String="&MIDENT;\s*\."/>
        <RegExpr attribute="Constructor" context="#stay" String="&MIDENT;"/>

        <!-- Interpreter directives. --> 
        <!-- (These are lines where the first symbol is a '#' followed by an identifier. -->
        <!-- Such lines could also be part of a method call split over two lines but     --> 
        <!-- it's unlikey anyone would code like that.)                                  -->
        <RegExpr attribute="Directive" context="#stay" String="#&IDENT;.*$" firstNonSpace="true"/>

        <!-- String, character and Camlp4 "quotation" constants.              --> 
        <!-- Note: If you must modify the pattern for characters be precise:  -->
        <!-- single quotes have several meanings in Ocaml.                    -->
        <DetectChar attribute="String" context="String Constant" char="&quot;" />
        <RegExpr attribute="Character" context="#stay" String="'(&ESC;|[^'])'" />
        <Detect2Chars attribute="Camlp4 Quotation" context="Camlp4 Quotation Constant" char="&lt;" char1="&lt;" />
        <RegExpr attribute="Camlp4 Quotation" context="Camlp4 Quotation Constant" String="&lt;:&IDENT;&lt;" />

        <!-- Identifiers and keywords. --> 
        <keyword attribute="Keyword" context="#stay" String="keywords" />
        <keyword attribute="Revised Syntax Keyword" context="#stay" String="revised syntax keywords" />
        <keyword attribute="Core Data Type" context="#stay" String="core types" />
        <RegExpr attribute="Identifier" context="#stay" String="&IDENT;" />

        <!-- Numeric constants. -->
        <!-- Note that they may contain underscores. --> 
        <RegExpr attribute="Hexadecimal" context="#stay" String="-?0[xX][0-9A-Fa-f_]+" />
        <RegExpr attribute="Octal" context="#stay" String="-?0[oO][0-7_]+" />
        <RegExpr attribute="Binary" context="#stay" String="-?0[bB][01_]+" />
        <RegExpr attribute="Float" context="#stay" String="-?&DEC;((\.(&DEC;)?([eE][-+]?&DEC;)?)|([eE][-+]?&DEC;))" />
        <RegExpr attribute="Decimal" context="#stay" String="-?&DEC;" />
      </context>

      <context attribute="Comment" lineEndContext="#stay" name="Multiline Comment">
        <!-- Support for nested comments -->
        <Detect2Chars attribute="Comment" context="#pop" char="*" char1=")" endRegion="comment" />
        <Detect2Chars attribute="Comment" context="Multiline Comment" char="(" char1="*" beginRegion="comment" />
      </context>

      <context attribute="String" lineEndContext="#stay" name="String Constant">
        <DetectChar attribute="String" context="#pop" char="&quot;" />
        <RegExpr attribute="Escaped characters" context="#stay" String="&ESC;" />
        <!-- An underscore at the end of a line in a string indicates  -->
        <!-- that the string will continue on the next line.           -->
        <RegExpr attribute="Escaped characters" context="#stay" String="\\$" />
      </context>

      <context attribute="Normal text" lineEndContext="#stay" name="Block">
        <keyword attribute="Region Marker" context="#pop" String="end" endRegion="block"/>
        <IncludeRules context="Normal"/>
      </context>

      <context attribute="Normal text" lineEndContext="#stay" name="Sig">
        <keyword attribute="Region Marker" context="#pop" String="end" endRegion="sig"/>
        <IncludeRules context="Normal"/>
      </context>

      <context attribute="Normal text" lineEndContext="#stay" name="Struct">
        <keyword attribute="Region Marker" context="#pop" String="end" endRegion="struct"/>
        <IncludeRules context="Normal"/>
      </context>
      
      <context attribute="Normal text" lineEndContext="#stay" name="Object">
        <keyword attribute="Region Marker" context="#pop" String="end" endRegion="object"/>
        <IncludeRules context="Normal"/>
      </context>
      
      <context attribute="Normal text" lineEndContext="#stay" name="ModuleEnv" fallthrough="true" fallthroughContext="#pop">
        <DetectSpaces attribute="Normal text" context="#stay"/>
        <RegExpr attribute="Module" lookAhead="true" context="ModuleEnv2" String="&MIDENT;\s*\."/>
        <RegExpr attribute="Module" context="#pop" String="&MIDENT;"/>
      </context>
      
      <context attribute="Normal text" lineEndContext="#stay" name="ModuleEnv2">
        <RegExpr attribute="Module" context="#stay" String="&MIDENT;"/>
        <DetectSpaces attribute="Normal text" context="#stay"/>
        <StringDetect attribute="Keyword" context="#pop" String="."/>
      </context>
      
      <!-- Camlp4 Quotations. These are source code literals used by the Campl4 preprocessor.           -->
      <!-- The only escapes allowed in a Camlp4 quotation are for the quotation start and stop symbols. -->
      <context attribute="Camlp4 Quotation" lineEndContext="#stay" name="Camlp4 Quotation Constant">
        <Detect2Chars attribute="Camlp4 Quotation" context="#pop" char="&gt;" char1="&gt;" />
        <Detect2Chars attribute="Camlp4 Quotation" context="Camlp4 Quotation Constant" char="&lt;" char1="&lt;" />
        <RegExpr attribute="Camlp4 Quotation" context="Camlp4 Quotation Constant" String="&lt;:&IDENT;&lt;" />
        <RegExpr attribute="Escaped characters" context="#stay" String="\\(\\|&gt;&gt;|&lt;&lt;)" />
        <RegExpr attribute="Escaped characters" context="#stay" String="\\&lt;:&IDENT;&lt;" />
      </context>
    </contexts>

    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal"/>
      <itemData name="Identifier" defStyleNum="dsNormal"/>
      <itemData name="Symbol" defStyleNum="dsNormal"/>
      <itemData name="Keyword"  defStyleNum="dsKeyword"/>
      <itemData name="Revised Syntax Keyword"  defStyleNum="dsNormal"/>
      <itemData name="Core Data Type"  defStyleNum="dsDataType"/>
      <itemData name="Decimal"  defStyleNum="dsDecVal"/>
      <itemData name="Hexadecimal"  defStyleNum="dsBaseN"/>
      <itemData name="Octal"  defStyleNum="dsBaseN"/>
      <itemData name="Binary"  defStyleNum="dsBaseN"/>
      <itemData name="Float"  defStyleNum="dsFloat"/>
      <itemData name="Character"  defStyleNum="dsChar"/>
      <itemData name="String"  defStyleNum="dsString"/>
      <itemData name="Escaped characters"  defStyleNum="dsChar"/>
      <itemData name="Comment"  defStyleNum="dsComment"/>
      <itemData name="Camlp4 Quotation"  defStyleNum="dsString"/>
      <itemData name="Directive"  defStyleNum="dsOthers"/>
      <itemData name="Constructor" defStyleNum="dsDataType"/>
      <itemData name="Module" defStyleNum="dsNormal"/>
      <itemData name="Region Marker" defStyleNum="dsKeyword"/>
    </itemDatas>
  </highlighting>

  <general>
    <keywords casesensitive="1" />
    <comments>
      <comment name="multiLine" start="(*" end="*)" />
    </comments>
  </general>
</language>
<!-- kate: space-indent on; indent-width 2; replace-tabs on; -->
