1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3
4 Author: Randy Abernethy <ra@apache.org>
5
6 GtkSourceView is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 GtkSourceView is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; if not, see <http://www.gnu.org/licenses/>.
18
19-->
20<language id="thrift" name="Thrift" version="2.0" _section="Source">
21  <metadata>
22    <property name="globs">*.thrift</property>
23    <property name="line-comment-start">//</property>
24    <property name="block-comment-start">/*</property>
25    <property name="block-comment-end">*/</property>
26  </metadata>
27
28  <styles>
29    <style id="comment"     name="Comment"      map-to="def:comment"/>
30    <style id="type"        name="Data Type"    map-to="def:type"/>
31    <style id="keyword"     name="Keyword"      map-to="def:keyword"/>
32    <style id="string"      name="String"       map-to="def:string"/>
33  </styles>
34
35  <definitions>
36
37    <define-regex id="ordinal" extended="true">
38      (?&lt;![\w\.]) ([1-9][0-9]*:) (?![\w\.])
39    </define-regex>
40
41    <context id="ordinal" style-ref="def:identifier">
42      <match>\%{ordinal}</match>
43    </context>
44
45    <context id="block-comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
46      <start>/\*</start>
47      <end>\*/</end>
48      <include>
49        <context ref="def:escape"/>
50        <context ref="def:line-continue"/>
51        <context ref="def:in-comment"/>
52      </include>
53    </context>
54
55    <context id="line-comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
56      <start>//</start>
57      <include>
58        <context ref="def:escape"/>
59        <context ref="def:line-continue"/>
60        <context ref="def:in-comment"/>
61      </include>
62    </context>
63
64    <context id="hash-line-comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
65      <start>#</start>
66      <include>
67        <context ref="def:escape"/>
68        <context ref="def:line-continue"/>
69        <context ref="def:in-comment"/>
70      </include>
71    </context>
72
73    <context id="string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
74      <start>"</start>
75      <end>"</end>
76      <include>
77        <context ref="def:escape"/>
78        <context ref="def:line-continue"/>
79      </include>
80    </context>
81
82    <context id="single-quote-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
83      <start>'</start>
84      <end>'</end>
85      <include>
86        <context ref="def:escape"/>
87        <context ref="def:line-continue"/>
88      </include>
89    </context>
90
91    <context id="keywords" style-ref="keyword">
92      <keyword>const</keyword>
93      <keyword>cpp_include</keyword>
94      <keyword>extends</keyword>
95      <keyword>false</keyword>
96      <keyword>include</keyword>
97      <keyword>namespace</keyword>
98      <keyword>oneway</keyword>
99      <keyword>optional</keyword>
100      <keyword>required</keyword>
101      <keyword>throws</keyword>
102      <keyword>true</keyword>
103      <keyword>typedef</keyword>
104    </context>
105
106    <context id="types" style-ref="type">
107      <keyword>binary</keyword>
108      <keyword>bool</keyword>
109      <keyword>byte</keyword>
110      <keyword>double</keyword>
111      <keyword>enum</keyword>
112      <keyword>exception</keyword>
113      <keyword>i16</keyword>
114      <keyword>i32</keyword>
115      <keyword>i64</keyword>
116      <keyword>list</keyword>
117      <keyword>map</keyword>
118      <keyword>service</keyword>
119      <keyword>set</keyword>
120      <keyword>string</keyword>
121      <keyword>struct</keyword>
122      <keyword>union</keyword>
123      <keyword>void</keyword>
124    </context>
125
126    <context id="reserved" style-ref="def:error">
127      <keyword>async</keyword>
128      <keyword>cocoa_prefix</keyword>
129      <keyword>cpp_namespace</keyword>
130      <keyword>csharp_namespace</keyword>
131      <keyword>delphi_namespace</keyword>
132      <keyword>java_package</keyword>
133      <keyword>perl_package</keyword>
134      <keyword>php_namespace</keyword>
135      <keyword>py_module</keyword>
136      <keyword>ruby_namespace</keyword>
137      <keyword>senum</keyword>
138      <keyword>smalltalk_category</keyword>
139      <keyword>slist</keyword>
140      <keyword>smalltalk_prefix</keyword>
141      <keyword>xsd_all</keyword>
142      <keyword>xsd_attrs</keyword>
143      <keyword>xsd_namespace</keyword>
144      <keyword>xsd_nillable</keyword>
145      <keyword>xsd_optional</keyword>
146      <keyword>BEGIN</keyword>
147      <keyword>END</keyword>
148      <keyword>__CLASS__</keyword>
149      <keyword>__DIR__</keyword>
150      <keyword>__FILE__</keyword>
151      <keyword>__FUNCTION__</keyword>
152      <keyword>__LINE__</keyword>
153      <keyword>__METHOD__</keyword>
154      <keyword>__NAMESPACE__</keyword>
155      <keyword>abstract</keyword>
156      <keyword>alias</keyword>
157      <keyword>and</keyword>
158      <keyword>args</keyword>
159      <keyword>as</keyword>
160      <keyword>assert</keyword>
161      <keyword>begin</keyword>
162      <keyword>break</keyword>
163      <keyword>case</keyword>
164      <keyword>catch</keyword>
165      <keyword>class</keyword>
166      <keyword>clone</keyword>
167      <keyword>continue</keyword>
168      <keyword>declare</keyword>
169      <keyword>def</keyword>
170      <keyword>default</keyword>
171      <keyword>del</keyword>
172      <keyword>delete</keyword>
173      <keyword>do</keyword>
174      <keyword>dynamic</keyword>
175      <keyword>elif</keyword>
176      <keyword>else</keyword>
177      <keyword>elseif</keyword>
178      <keyword>elsif</keyword>
179      <keyword>end</keyword>
180      <keyword>enddeclare</keyword>
181      <keyword>endfor</keyword>
182      <keyword>endforeach</keyword>
183      <keyword>endif</keyword>
184      <keyword>endswitch</keyword>
185      <keyword>endwhile</keyword>
186      <keyword>ensure</keyword>
187      <keyword>except</keyword>
188      <keyword>exec</keyword>
189      <keyword>finally</keyword>
190      <keyword>float</keyword>
191      <keyword>for</keyword>
192      <keyword>foreach</keyword>
193      <keyword>function</keyword>
194      <keyword>global</keyword>
195      <keyword>goto</keyword>
196      <keyword>if</keyword>
197      <keyword>implements</keyword>
198      <keyword>import</keyword>
199      <keyword>in</keyword>
200      <keyword>inline</keyword>
201      <keyword>instanceof</keyword>
202      <keyword>interface</keyword>
203      <keyword>is</keyword>
204      <keyword>lambda</keyword>
205      <keyword>module</keyword>
206      <keyword>native</keyword>
207      <keyword>new</keyword>
208      <keyword>next</keyword>
209      <keyword>nil</keyword>
210      <keyword>not</keyword>
211      <keyword>or</keyword>
212      <keyword>pass</keyword>
213      <keyword>public</keyword>
214      <keyword>print</keyword>
215      <keyword>private</keyword>
216      <keyword>protected</keyword>
217      <keyword>public</keyword>
218      <keyword>raise</keyword>
219      <keyword>redo</keyword>
220      <keyword>rescue</keyword>
221      <keyword>retry</keyword>
222      <keyword>register</keyword>
223      <keyword>return</keyword>
224      <keyword>self</keyword>
225      <keyword>sizeof</keyword>
226      <keyword>static</keyword>
227      <keyword>super</keyword>
228      <keyword>switch</keyword>
229      <keyword>synchronized</keyword>
230      <keyword>then</keyword>
231      <keyword>this</keyword>
232      <keyword>throw</keyword>
233      <keyword>transient</keyword>
234      <keyword>try</keyword>
235      <keyword>undef</keyword>
236      <keyword>union</keyword>
237      <keyword>unless</keyword>
238      <keyword>unsigned</keyword>
239      <keyword>until</keyword>
240      <keyword>use</keyword>
241      <keyword>var</keyword>
242      <keyword>virtual</keyword>
243      <keyword>volatile</keyword>
244      <keyword>when</keyword>
245      <keyword>while</keyword>
246      <keyword>with</keyword>
247      <keyword>xor</keyword>
248      <keyword>yield</keyword>
249    </context>
250
251    <context id="thrift" class="no-spell-check">
252      <include>
253        <context ref="block-comment"/>
254        <context ref="line-comment"/>
255        <context ref="hash-line-comment"/>
256        <context ref="string"/>
257        <context ref="single-quote-string"/>
258        <context ref="keywords"/>
259        <context ref="types"/>
260        <context ref="ordinal"/>
261        <context ref="reserved"/>
262      </include>
263    </context>
264
265  </definitions>
266</language>
267