Refactoring of rec process "~" in faustexp.ml.
[Faustine.git] / interpretor / faust-0.9.47mr3 / syntax-highlighting / faust.lang
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="faust" _name="Faust" version="2.0" _section="Sources">
25 <metadata>
26 <property name="mimetypes">text/x-faust</property>
27 <property name="globs">*.dsp</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="primitive" _name="Primitive" map-to="def:keyword"/>
35 <style id="structure" _name="Structure" map-to="def:statement"/>
36
37 <style id="comment" _name="Comment" map-to="def:comment"/>
38 <style id="error" _name="Error" map-to="def:error"/>
39 <style id="string" _name="String" map-to="def:string"/>
40 <style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
41 <style id="common-defines" _name="Common Defines" map-to="def:special-constant"/>
42 <style id="included-file" _name="Included File" map-to="def:string"/>
43 <style id="char" _name="Character" map-to="def:character"/>
44 <style id="keyword" _name="Keyword" map-to="def:keyword"/>
45 <style id="type" _name="Data Type" map-to="def:type"/>
46 <style id="storage-class" _name="Storage Class" map-to="def:type"/>
47 <style id="printf" _name="printf Conversion" map-to="def:special-char"/>
48 <style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
49 <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
50 <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
51 <style id="octal" _name="Octal number" map-to="def:base-n-integer"/>
52 <style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
53 <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
54 </styles>
55
56 <definitions>
57 <!-- TODO: what about scanf ? -->
58 <!-- man 3 printf -->
59 <context id="printf" style-ref="printf" extend-parent="false">
60 <match extended="true">
61 \%\%|\%
62 (?:[1-9][0-9]*\$)? # argument
63 [#0\-\ \+\'I]* # flags
64 (?:[1-9][0-9]*|\*)? # width
65 (?:\.\-?(?:[0-9]+|\*))? # precision
66 (?:hh|ll|[hlLqjzt])? # length modifier
67 [diouxXeEfFgGaAcsCSpnm] # conversion specifier
68 </match>
69 </context>
70
71 <define-regex id="escaped-character" extended="true">
72 \\( # leading backslash
73 [\\\"\'nrbtfav\?] | # escaped character
74 [0-7]{1,3} | # one, two, or three octal digits
75 x[0-9A-Fa-f]+ # 'x' followed by hex digits
76 )
77 </define-regex>
78
79 <context id="faust">
80 <include>
81
82 <!-- gtk-doc -->
83 <context ref="gtk-doc:inline-docs-section"/>
84
85 <!-- Comments -->
86 <context id="comment" style-ref="comment" end-at-line-end="true">
87 <start>//</start>
88 <include>
89 <context ref="def:in-line-comment"/>
90 </include>
91 </context>
92
93 <context id="comment-multiline" style-ref="comment">
94 <start>/\*</start>
95 <end>\*/</end>
96 <include>
97 <context ref="def:in-comment"/>
98 </include>
99 </context>
100
101 <context id="close-comment-outside-comment" style-ref="error">
102 <match>\*/(?!\*)</match>
103 </context>
104
105 <!-- Preprocessor -->
106 <define-regex id="preproc-start">^\s*#\s*</define-regex>
107
108 <context id="if0-comment" style-ref="comment">
109 <start>\%{preproc-start}if\b\s*0\b</start>
110 <end>\%{preproc-start}(endif|else|elif)\b</end>
111 <include>
112 <context id="if-in-if0">
113 <start>\%{preproc-start}if(n?def)?\b</start>
114 <end>\%{preproc-start}endif\b</end>
115 <include>
116 <context ref="if-in-if0"/>
117 <context ref="def:in-comment"/>
118 </include>
119 </context>
120 <context ref="def:in-comment"/>
121 </include>
122 </context>
123
124 <context id="include" style-ref="preprocessor">
125 <match extended="true">
126 \%{preproc-start}
127 (include|import)\s*
128 (".*?"|&lt;.*&gt;)
129 </match>
130 <include>
131 <context id="included-file" sub-pattern="2" style-ref="included-file"/>
132 </include>
133 </context>
134
135 <context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
136 <start extended="true">
137 \%{preproc-start}
138 (define|undef|error|pragma|ident|if(n?def)?|else|elif|endif|line|warning)
139 \b
140 </start>
141 <include>
142 <context ref="def:line-continue" ignore-style="true"/>
143 <context ref="string" ignore-style="true"/>
144 <context ref="comment"/>
145 <context ref="comment-multiline"/>
146 </include>
147 </context>
148
149 <context id="string" style-ref="string" end-at-line-end="true">
150 <start>L?"</start>
151 <end>"</end>
152 <include>
153 <context ref="printf"/>
154 <context id="escaped-character" style-ref="escaped-character">
155 <match>\%{escaped-character}</match>
156 </context>
157 <context ref="def:line-continue"/>
158 </include>
159 </context>
160
161 <context id="char" style-ref="char">
162 <match>L?'(\%{escaped-character}|.)'</match>
163 </context>
164
165 <!-- http://www.lysator.liu.se/c/ANSI-C-grammar-l.html -->
166 <context id="float" style-ref="floating-point">
167 <match extended="true">
168 (?&lt;![\w\.])
169 ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
170 ([0-9]+[Ee][+-]?[0-9]*))
171 [fFlL]?
172 (?![\w\.])
173 </match>
174 </context>
175
176 <context id="hexadecimal" style-ref="hexadecimal">
177 <match extended="true">
178 (?&lt;![\w\.])
179 0[xX][a-fA-F0-9]+[uUlL]*
180 (?![\w\.])
181 </match>
182 </context>
183
184 <context id="octal" style-ref="octal">
185 <match extended="true">
186 (?&lt;![\w\.])
187 0[0-7]+[uUlL]*
188 (?![\w\.])
189 </match>
190 </context>
191
192 <context id="decimal" style-ref="decimal">
193 <match extended="true">
194 (?&lt;![\w\.])
195 [0-9]+[uUlL]*
196 (?![\w\.])
197 </match>
198 </context>
199
200 <!-- Keywords -->
201 <context id="primitive" style-ref="primitive">
202 <keyword>mem</keyword>
203 <keyword>prefix</keyword>
204 <keyword>int</keyword>
205 <keyword>float</keyword>
206 <keyword>rdtable</keyword>
207 <keyword>rwtable</keyword>
208 <keyword>select2</keyword>
209 <keyword>select3</keyword>
210 <keyword>ffunction</keyword>
211 <keyword>fconstant</keyword>
212 <keyword>fvariable</keyword>
213 <keyword>button</keyword>
214 <keyword>checkbox</keyword>
215 <keyword>vslider</keyword>
216 <keyword>hslider</keyword>
217 <keyword>nentry</keyword>
218 <keyword>vgroup</keyword>
219 <keyword>hgroup</keyword>
220 <keyword>tgroup</keyword>
221 <keyword>vbargraph</keyword>
222 <keyword>hbargraph</keyword>
223 <keyword>attach</keyword>
224 <keyword>acos</keyword>
225 <keyword>asin</keyword>
226 <keyword>atan</keyword>
227 <keyword>atan2</keyword>
228 <keyword>cos</keyword>
229 <keyword>sin</keyword>
230 <keyword>tan</keyword>
231 <keyword>exp</keyword>
232 <keyword>log</keyword>
233 <keyword>log10</keyword>
234 <keyword>pow</keyword>
235 <keyword>sqrt</keyword>
236 <keyword>abs</keyword>
237 <keyword>min</keyword>
238 <keyword>max</keyword>
239 <keyword>fmod</keyword>
240 <keyword>remainder</keyword>
241 <keyword>floor</keyword>
242 <keyword>ceil</keyword>
243 <keyword>rint</keyword>
244 </context>
245
246 <context id="structure" style-ref="structure">
247 <keyword>process</keyword>
248
249 <keyword>with</keyword>
250 <keyword>case</keyword>
251 <keyword>seq</keyword>
252 <keyword>par</keyword>
253 <keyword>sum</keyword>
254 <keyword>prod</keyword>
255 <keyword>import</keyword>
256
257 <keyword>component</keyword>
258 <keyword>library</keyword>
259 <keyword>environment</keyword>
260
261 <keyword>declare</keyword>
262 </context>
263
264
265
266 </include>
267 </context>
268 </definitions>
269 </language>