/[ascend]/trunk/tools/gtksourceview-2.0/ascend.lang
ViewVC logotype

Contents of /trunk/tools/gtksourceview-2.0/ascend.lang

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1944 - (show annotations) (download)
Thu Nov 6 06:57:40 2008 UTC (13 years, 8 months ago) by jpye
File size: 13410 byte(s)
Add a few missing type definitions to highlighting.
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3
4 Authors: Marco Barisione, Emanuele Aina
5 Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
6 Copyright (C) 2005-2007 Emanuele Aina
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public
19 License along with this library; if not, write to the
20 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.
22
23 -->
24 <language id="ascend" _name="ASCEND" version="2.0" _section="Scientific">
25 <metadata>
26 <property name="mimetypes">text/x-ascend-model</property>
27 <property name="globs">*.a4c;*.a4l</property>
28 <property name="line-comment-start">//</property>
29 <property name="block-comment-start">(*</property>
30 <property name="block-comment-end">*)</property>
31 </metadata>
32
33 <styles>
34 <style id="comment" _name="Comment" map-to="def:comment"/>
35 <style id="error" _name="Error" map-to="def:error"/>
36 <style id="string" _name="String" map-to="def:string"/>
37 <style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
38 <style id="common-defines" _name="Common Defines" map-to="def:special-constant"/>
39 <style id="included-file" _name="Included File" map-to="def:string"/>
40 <style id="char" _name="Character" map-to="def:character"/>
41 <style id="keyword" _name="Keyword" map-to="def:keyword"/>
42 <style id="type" _name="Data Type" map-to="def:type"/>
43 <style id="storage-class" _name="Storage Class" map-to="def:type"/>
44 <style id="printf" _name="printf Conversion" map-to="def:character"/>
45 <style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
46 <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
47 <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
48 <style id="octal" _name="Octal number" map-to="def:base-n-integer"/>
49 <style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
50 <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
51 </styles>
52
53 <definitions>
54 <!-- TODO: what about scanf ? -->
55 <!-- man 3 printf -->
56 <context id="printf" style-ref="printf" extend-parent="false">
57 <match extended="true">
58 \%\%|
59 \%([1-9][0-9]*\$)?
60 [#0\-\ \+\'I]*
61 (\-?[1-9][0-9]*)?
62 (\.\-?[1-9][0-9]*)?
63 (hh|ll|[hlLqjzt])?
64 [diouxXeEfFgGaAcsCSpnm]
65 </match>
66 </context>
67
68 <!-- http://en.wikipedia.org/wiki/C_syntax#Strings -->
69 <define-regex id="escaped-character" extended="true">
70 \\( # leading backslash
71 [\\\"\'nrtfav\?e] | # escaped character
72 [0-7]{1,3} | # one, two, or three octal digits
73 x[0-9A-Fa-f]{0,2} # 'x' followed by zero, one, or two hex digits
74 )
75 </define-regex>
76
77 <context id="ascend">
78 <include>
79
80 <!-- gtk-doc -->
81 <context ref="gtk-doc:inline-docs-section"/>
82
83 <!-- Comments -->
84 <context id="comment" style-ref="comment" end-at-line-end="true">
85 <start>//</start>
86 <include>
87 <context ref="def:in-line-comment"/>
88 </include>
89 </context>
90
91 <context id="comment-multiline" style-ref="comment">
92 <start>\(\*</start>
93 <end>\*\)</end>
94 <include>
95 <context ref="def:in-comment"/>
96 </include>
97 </context>
98
99 <context id="close-comment-outside-comment" style-ref="error">
100 <match>\*\)(?!\(*)</match>
101 </context>
102
103 <!-- Preprocessor -->
104 <define-regex id="preproc-start">^\s*#\s*</define-regex>
105
106 <context id="if0-comment" style-ref="comment">
107 <start>\%{preproc-start}if\b\s*0\b</start>
108 <end>\%{preproc-start}(endif|else|elif)\b</end>
109 <include>
110 <context id="if-in-if0">
111 <start>\%{preproc-start}if(n?def)?\b</start>
112 <end>\%{preproc-start}endif\b</end>
113 <include>
114 <context ref="if-in-if0"/>
115 <context ref="def:in-comment"/>
116 </include>
117 </context>
118 <context ref="def:in-comment"/>
119 </include>
120 </context>
121
122 <context id="include" style-ref="preprocessor">
123 <match extended="true">
124 \%{preproc-start}
125 (include|import)\s*
126 (".*?"|&lt;.*&gt;)
127 </match>
128 <include>
129 <context id="included-file" sub-pattern="2" style-ref="included-file"/>
130 </include>
131 </context>
132
133 <context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
134 <start extended="true">
135 \%{preproc-start}
136 (define|undef|error|pragma|ident|if(n?def)?|else|elif|endif|line|warning)
137 \b
138 </start>
139 <include>
140 <context ref="def:line-continue" ignore-style="true"/>
141 <context ref="string" ignore-style="true"/>
142 <context ref="comment"/>
143 <context ref="comment-multiline"/>
144 </include>
145 </context>
146
147 <context id="string" style-ref="string" end-at-line-end="true">
148 <start>"</start>
149 <end>"</end>
150 <include>
151 <context ref="printf"/>
152 <context id="escaped-character" style-ref="escaped-character">
153 <match>\%{escaped-character}</match>
154 </context>
155 <context ref="def:line-continue"/>
156 </include>
157 </context>
158
159 <context id="char" style-ref="char" end-at-line-end="false">
160 <start>'</start>
161 <end>'</end>
162 <include>
163 <context id="char-escaped-character" style-ref="escaped-character">
164 <match>\%{escaped-character}</match>
165 </context>
166 </include>
167 </context>
168
169 <!-- http://www.lysator.liu.se/c/ANSI-C-grammar-l.html -->
170 <context id="float" style-ref="floating-point">
171 <match extended="true">
172 (?&lt;![\w\.])
173 ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
174 ([0-9]+[Ee][+-]?[0-9]*))
175 [fFlL]?
176 (?![\w\.])
177 </match>
178 </context>
179
180 <context id="hexadecimal" style-ref="hexadecimal">
181 <match extended="true">
182 (?&lt;![\w\.])
183 0[xX][a-fA-F0-9]+[uUlL]*
184 (?![\w\.])
185 </match>
186 </context>
187
188 <context id="octal" style-ref="octal">
189 <match extended="true">
190 (?&lt;![\w\.])
191 0[0-7]+[uUlL]*
192 (?![\w\.])
193 </match>
194 </context>
195
196 <context id="decimal" style-ref="decimal">
197 <match extended="true">
198 (?&lt;![\w\.])
199 [0-9]+[uUlL]*
200 (?![\w\.])
201 </match>
202 </context>
203
204 <!-- Keywords -->
205 <context id="keywords" style-ref="keyword">
206 <keyword>ADD</keyword>
207 <keyword>AND</keyword>
208 <keyword>ALIASES</keyword>
209 <keyword>ARE_ALIKE</keyword>
210 <keyword>ARE_THE_SAME</keyword>
211 <keyword>ARE_NOT_THE_SAME</keyword>
212 <keyword>ASSERT</keyword>
213 <keyword>ATOM</keyword>
214 <keyword>CALL</keyword>
215 <keyword>CASE</keyword>
216 <keyword>CARD</keyword>
217 <keyword>CHECK</keyword>
218 <keyword>CHOICE</keyword>
219 <keyword>CONSTANT</keyword>
220 <keyword>CONDITIONAL</keyword>
221 <keyword>CREATE</keyword>
222 <keyword>DATA</keyword>
223 <keyword>DEFAULT</keyword>
224 <keyword>DEFINITION</keyword>
225 <keyword>DO</keyword>
226 <keyword>ELSE</keyword>
227 <keyword>END</keyword>
228 <keyword>EXTERNAL</keyword>
229 <keyword>FIX</keyword>
230 <keyword>FOR</keyword>
231 <keyword>FREE</keyword>
232 <keyword>IF</keyword>
233 <keyword>IMPORT</keyword>
234 <keyword>IN</keyword>
235 <keyword>INPUT</keyword>
236 <keyword>INTERSECTION</keyword>
237 <keyword>IS_A</keyword>
238 <keyword>IS_REFINED_TO</keyword>
239 <keyword>MAX</keyword>
240 <keyword>MAXIMIZE</keyword>
241 <keyword>METHOD</keyword>
242 <keyword>METHODS</keyword>
243 <keyword>MIN</keyword>
244 <keyword>MINIMIZE</keyword>
245 <keyword>MODEL</keyword>
246 <keyword>NOTES</keyword>
247 <keyword>OF</keyword>
248 <keyword>OR</keyword>
249 <keyword>OTHERWISE</keyword>
250 <keyword>OUTPUT</keyword>
251 <keyword>PROVIDE</keyword>
252 <keyword>PROD</keyword>
253 <keyword>REPLACE</keyword>
254 <keyword>REQUIRE</keyword>
255 <keyword>REFINES</keyword>
256 <keyword>RUN</keyword>
257 <keyword>SATISFIED</keyword>
258 <keyword>SELECT</keyword>
259 <keyword>SELF</keyword>
260 <keyword>STUDY</keyword>
261 <keyword>SUCH_THAT</keyword>
262 <keyword>SUM</keyword>
263 <keyword>SWITCH</keyword>
264 <keyword>THEN</keyword>
265 <keyword>UNIVERSAL</keyword>
266 <keyword>UNION</keyword>
267 <keyword>UNITS</keyword>
268 <keyword>USE</keyword>
269 <keyword>WHEN</keyword>
270 <keyword>WHERE</keyword>
271 <keyword>WITH_VALUE</keyword>
272 <keyword>WILL_BE</keyword>
273 <keyword>WILL_BE_THE_SAME</keyword>
274 <keyword>WILL_NOT_BE_THE_SAME</keyword>
275 </context>
276
277 <context id="types" style-ref="type">
278 <keyword>real_constant</keyword>
279 <keyword>integer_constant</keyword>
280 <keyword>symbol_constant</keyword>
281 <keyword>boolean_constant</keyword>
282
283 <keyword>real</keyword>
284 <keyword>integer</keyword>
285 <keyword>symbol</keyword>
286 <keyword>boolean</keyword>
287 <keyword>set</keyword>
288
289 <keyword>solver_var</keyword>
290 <keyword>factor</keyword>
291 <keyword>fraction</keyword>
292
293 <keyword>mass</keyword>
294 <keyword>mole</keyword>
295 <keyword>molar_mass</keyword>
296 <keyword>mass_density</keyword>
297 <keyword>molar_density</keyword>
298 <keyword>pressure</keyword>
299 <keyword>stress</keyword>
300 <keyword>temperature</keyword>
301 <keyword>energy</keyword>
302 <keyword>energy_rate</keyword>
303 <keyword>distance</keyword>
304 <keyword>area</keyword>
305 <keyword>volume</keyword>
306 <keyword>specific_volume</keyword>
307 <keyword>specific_enthalpy</keyword>
308 <keyword>specific_energy</keyword>
309 <keyword>specific_entropy</keyword>
310
311 </context>
312
313 <context id="storage-class" style-ref="storage-class">
314 <keyword>on_load</keyword>
315 <keyword>default_self</keyword>
316 <keyword>specify</keyword>
317 <keyword>reset</keyword>
318 <keyword>ClearAll</keyword>
319 <keyword>bound_self</keyword>
320 <keyword>default_all</keyword>
321 <keyword>bound_all</keyword>
322 <keyword>self_test</keyword>
323 </context>
324
325 <context id="common-defines" style-ref="common-defines">
326 <keyword>NULL</keyword>
327 <keyword>MAX</keyword>
328 <keyword>MIN</keyword>
329 <keyword>__LINE__</keyword>
330 <keyword>__DATA__</keyword>
331 <keyword>__FILE__</keyword>
332 <keyword>__func__</keyword>
333 <keyword>__TIME__</keyword>
334 <keyword>__STDC__</keyword>
335 </context>
336
337 <context id="boolean" style-ref="boolean">
338 <keyword>TRUE</keyword>
339 <keyword>FALSE</keyword>
340 </context>
341
342 </include>
343 </context>
344 </definitions>
345 </language>

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22