1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3
4 This file is part of GtkSourceView
5
6 Author: Amos Wenger aka nddrylliog <amoswenger@gmail.com>
7 Copyright (C) 2010 Amos Wenger aka nddrylliog <amoswenger@gmail.com>
8
9 GtkSourceView is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 GtkSourceView is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with this library; if not, see <http://www.gnu.org/licenses/>.
21
22-->
23<language id="ooc" name="OOC" version="2.0" _section="Source">
24  <metadata>
25    <property name="globs">*.ooc</property>
26    <property name="line-comment-start">//</property>
27    <property name="block-comment-start">/*</property>
28    <property name="block-comment-end">*/</property>
29  </metadata>
30
31  <styles>
32    <style id="comment"           name="Comment"                  map-to="def:comment"/>
33    <style id="error"             name="Error"                    map-to="def:error"/>
34    <style id="escaped-character" name="Escaped Character"        map-to="def:special-char"/>
35    <style id="string"            name="String"                   map-to="def:string"/>
36    <style id="external"          name="External"                 map-to="def:preprocessor"/>
37    <style id="declaration"       name="Declaration"              map-to="def:type"/>
38    <style id="storage-class"     name="Storage Class"            map-to="def:type"/>
39    <style id="scope-declaration" name="Scope Declaration"        map-to="def:type"/>
40    <style id="keyword"           name="Keyword"                  map-to="def:keyword"/>
41    <style id="null-value"        name="Null Value"               map-to="def:special-constant"/>
42    <style id="boolean"           name="Boolean value"            map-to="def:boolean"/>
43    <style id="floating-point"    name="Floating point number"    map-to="def:floating-point"/>
44    <style id="decimal"           name="Decimal number"           map-to="def:decimal"/>
45    <style id="octal"             name="Octal number"             map-to="def:base-n-integer"/>
46    <style id="hexadecimal"       name="Hexadecimal number"       map-to="def:base-n-integer"/>
47    <style id="reserved"          name="Future Reserved Keywords" map-to="def:error"/>
48    <style id="type"              name="Data Type"                map-to="def:type"/>
49  </styles>
50
51  <definitions>
52
53    <define-regex id="escaped-character" extended="true">
54      \\(               # leading backslash
55      [\\\"\'nrbtf] |   # escaped character
56      [0-9]{1,3}    |   # latin encoded char
57      u[0-9]{1,4}       # unicode char
58      )
59    </define-regex>
60
61    <context id="string" style-ref="string" end-at-line-end="false">
62      <start>"</start>
63      <end>"</end>
64      <include>
65        <context id="escaped-character" style-ref="escaped-character">
66          <match>\%{escaped-character}</match>
67        </context>
68      </include>
69    </context>
70
71    <context id="line-comment" style-ref="comment" end-at-line-end="true">
72      <start>//</start>
73      <include>
74        <context ref="def:in-line-comment"/>
75      </include>
76    </context>
77
78    <context id="block-comment" style-ref="comment">
79      <start>/\*</start>
80      <end>\*/</end>
81      <include>
82        <context ref="def:in-comment"/>
83      </include>
84    </context>
85
86    <context id="close-comment-outside-comment" style-ref="error">
87      <match>\*/(?!\*)</match>
88    </context>
89
90    <context id="externals" style-ref="external">
91      <keyword>import</keyword>
92      <keyword>include</keyword>
93      <keyword>use</keyword>
94    </context>
95
96    <context id="declarations" style-ref="declaration">
97      <keyword>class</keyword>
98      <keyword>cover</keyword>
99      <keyword>func</keyword>
100      <keyword>implement</keyword>
101      <keyword>interface</keyword>
102      <keyword>operator</keyword>
103    </context>
104
105    <context id="primitive-types" style-ref="type">
106      <keyword>Int</keyword>
107      <keyword>Int8</keyword>
108      <keyword>Int16</keyword>
109      <keyword>Int32</keyword>
110      <keyword>Int64</keyword>
111      <keyword>Int80</keyword>
112      <keyword>Int128</keyword>
113
114      <keyword>UInt</keyword>
115      <keyword>UInt8</keyword>
116      <keyword>UInt16</keyword>
117      <keyword>UInt32</keyword>
118      <keyword>UInt64</keyword>
119      <keyword>UInt80</keyword>
120      <keyword>UInt128</keyword>
121
122      <keyword>Octet</keyword>
123      <keyword>Short</keyword>
124      <keyword>UShort</keyword>
125      <keyword>Long</keyword>
126      <keyword>ULong</keyword>
127      <keyword>LLong</keyword>
128      <keyword>ULLong</keyword>
129
130      <keyword>Float</keyword>
131      <keyword>Double</keyword>
132      <keyword>LDouble</keyword>
133      <keyword>Float32</keyword>
134      <keyword>Float64</keyword>
135      <keyword>Float128</keyword>
136
137      <keyword>Char</keyword>
138      <keyword>UChar</keyword>
139      <keyword>SChar</keyword>
140      <keyword>WChar</keyword>
141      <keyword>String</keyword>
142
143      <keyword>Void</keyword>
144      <keyword>Pointer</keyword>
145      <keyword>Bool</keyword>
146      <keyword>SizeT</keyword>
147      <keyword>This</keyword>
148    </context>
149
150    <context id="storage-class" style-ref="storage-class">
151      <keyword>abstract</keyword>
152      <keyword>static</keyword>
153      <keyword>final</keyword>
154      <keyword>extern</keyword>
155      <keyword>const</keyword>
156      <keyword>proto</keyword>
157    </context>
158
159    <context id="scope-declarations" style-ref="scope-declaration">
160      <keyword>private</keyword>
161      <keyword>protected</keyword>
162      <keyword>public</keyword>
163      <keyword>internal</keyword>
164    </context>
165
166    <context id="flow" style-ref="keyword">
167      <keyword>as</keyword>
168      <keyword>break</keyword>
169      <keyword>continue</keyword>
170      <keyword>else</keyword>
171      <keyword>fallthrough</keyword>
172      <keyword>finally</keyword>
173      <keyword>for</keyword>
174      <keyword>if</keyword>
175      <keyword>match</keyword>
176      <keyword>return</keyword>
177      <keyword>while</keyword>
178    </context>
179
180    <context id="memory" style-ref="keyword">
181      <keyword>new</keyword>
182      <keyword>this</keyword>
183    </context>
184
185    <context id="future-reserved-words" style-ref="reserved">
186      <keyword>catch</keyword>
187      <keyword>const</keyword>
188      <keyword>goto</keyword>
189      <keyword>finally</keyword>
190      <keyword>throw</keyword>
191      <keyword>try</keyword>
192      <keyword>with</keyword>
193      <keyword>scope</keyword>
194    </context>
195
196    <context id="null-value" style-ref="null-value">
197      <keyword>null</keyword>
198    </context>
199
200    <context id="boolean" style-ref="boolean">
201      <keyword>false</keyword>
202      <keyword>true</keyword>
203    </context>
204
205    <!-- http://www.lysator.liu.se/c/ANSI-C-grammar-l.html -->
206    <context id="float" style-ref="floating-point">
207        <match extended="true">
208            (?&lt;![\w\.])
209            ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
210             ([0-9]+[Ee][+-]?[0-9]*))
211            [fFlL]?
212            (?![\w\.])
213        </match>
214    </context>
215
216    <context id="hexadecimal" style-ref="hexadecimal">
217        <match extended="true">
218            (?&lt;![\w\.])
219            0[xX][a-fA-F0-9]+[uUlL]*
220            (?![\w\.])
221        </match>
222    </context>
223
224    <context id="octal" style-ref="octal">
225        <match extended="true">
226            (?&lt;![\w\.])
227            0[cC][0-7]+[uUlL]*
228            (?![\w\.])
229        </match>
230    </context>
231
232    <context id="decimal" style-ref="decimal">
233        <match extended="true">
234            (?&lt;![\w\.])
235            [0-9]+[uUlL]*
236            (?![\w\.])
237        </match>
238    </context>
239
240    <context id="ooc">
241      <include>
242        <context ref="string"/>
243        <context ref="line-comment"/>
244        <context ref="block-comment"/>
245        <context ref="close-comment-outside-comment"/>
246        <context ref="externals"/>
247        <context ref="declarations"/>
248        <context ref="primitive-types"/>
249        <context ref="storage-class"/>
250        <context ref="scope-declarations"/>
251        <context ref="flow"/>
252        <context ref="memory"/>
253        <context ref="future-reserved-words"/>
254        <context ref="null-value"/>
255        <context ref="boolean"/>
256        <context ref="decimal"/>
257        <context ref="hexadecimal"/>
258        <context ref="octal"/>
259        <context ref="float"/>
260      </include>
261    </context>
262
263  </definitions>
264</language>
265