summaryrefslogtreecommitdiffstats
path: root/kate/data/ocaml.xml
blob: 6d7a07d490d78317ed8de99b54148eec1fb3eb4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?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 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.04" 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> 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> 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>
    <contexts>

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

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

        <!-- 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>

      <!-- 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="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"/>
    </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; -->