Debian Codegraph @

data/syntax/praat.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language
3 [
4 <!ENTITY B '([^a-zA-Z0-9\._"&apos;\$#\[:\(]|\s|^|$)'>
5 ]>
6 <!--
7 This file is part of the KDE project
8 Copyright (C) 2016 José Joaquín Atria <[email protected]>
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public
12 License version 2 as published by the Free Software Foundation.
13
14 This library 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 Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
23 -->
24 <language name="Praat" version="6" kateversion="5.0" section="Scripts" extensions="*.Praat;*.praat;*.psc;*.praat-script;*.praatscript;*.proc" author="Jose Joaquín Atria ([email protected])" license="LGPLv2">
25 <highlighting>
26 <list name="keywords">
27 <item>assert</item>
28 <item>clearinfo</item>
29 <item>demo</item>
30 <item>elif</item>
31 <item>else</item>
32 <item>elsif</item>
33 <item>from</item>
34 <item>minus</item>
35 <item>nocheck</item>
36 <item>noprogress</item>
37 <item>nowarn</item>
38 <item>plus</item>
39 <item>select</item>
40 <item>stopwatch</item>
41 <item>then</item>
42 <item>to</item>
43 </list>
44 <list name="functions_string">
45 <item>backslashTrigraphsToUnicode$</item>
46 <item>chooseDirectory$</item>
47 <item>chooseReadFile$</item>
48 <item>chooseWriteFile$</item>
49 <item>date$</item>
50 <item>demoKey$</item>
51 <item>do$</item>
52 <item>environment$</item>
53 <item>extractLine$</item>
54 <item>extractWord$</item>
55 <item>fixed$</item>
56 <item>info$</item>
57 <item>left$</item>
58 <item>mid$</item>
59 <item>percent$</item>
60 <item>readFile$</item>
61 <item>replace$</item>
62 <item>replace_regex$</item>
63 <item>right$</item>
64 <item>selected$</item>
65 <item>string$</item>
66 </list>
67 <list name="functions_numeric">
68 <item>abs</item>
69 <item>appendFile</item>
70 <item>appendFileLine</item>
71 <item>appendInfo</item>
72 <item>appendInfoLine</item>
73 <item>arccos</item>
74 <item>arccosh</item>
75 <item>arcsin</item>
76 <item>arcsinh</item>
77 <item>arctan</item>
78 <item>arctan2</item>
79 <item>arctanh</item>
80 <item>barkToHertz</item>
81 <item>beginPause</item>
82 <item>beginSendPraat</item>
83 <item>besselI</item>
84 <item>besselK</item>
85 <item>beta</item>
86 <item>beta2</item>
87 <item>binomialP</item>
88 <item>binomialQ</item>
89 <item>boolean</item>
90 <item>ceiling</item>
91 <item>chiSquareP</item>
92 <item>chiSquareQ</item>
93 <item>choice</item>
94 <item>comment</item>
95 <item>cos</item>
96 <item>cosh</item>
97 <item>createDirectory</item>
98 <item>deleteFile</item>
99 <item>demoClicked</item>
100 <item>demoClickedIn</item>
101 <item>demoCommandKeyPressed</item>
102 <item>demoExtraControlKeyPressed</item>
103 <item>demoInput</item>
104 <item>demoKeyPressed</item>
105 <item>demoOptionKeyPressed</item>
106 <item>demoShiftKeyPressed</item>
107 <item>demoShow</item>
108 <item>demoWaitForInput</item>
109 <item>demoWindowTitle</item>
110 <item>demoX</item>
111 <item>demoY</item>
112 <item>differenceLimensToPhon</item>
113 <item>do</item>
114 <item>editor</item>
115 <item>endPause</item>
116 <item>endSendPraat</item>
117 <item>endsWith</item>
118 <item>erb</item>
119 <item>erbToHertz</item>
120 <item>erf</item>
121 <item>erfc</item>
122 <item>exitScript</item>
123 <item>exp</item>
124 <item>extractNumber</item>
125 <item>fileReadable</item>
126 <item>fisherP</item>
127 <item>fisherQ</item>
128 <item>floor</item>
129 <item>gaussP</item>
130 <item>gaussQ</item>
131 <item>hash</item>
132 <item>hertzToBark</item>
133 <item>hertzToErb</item>
134 <item>hertzToMel</item>
135 <item>hertzToSemitones</item>
136 <item>imax</item>
137 <item>imin</item>
138 <item>incompleteBeta</item>
139 <item>incompleteGammaP</item>
140 <item>index</item>
141 <item>index_regex</item>
142 <item>integer</item>
143 <item>invBinomialP</item>
144 <item>invBinomialQ</item>
145 <item>invChiSquareQ</item>
146 <item>invFisherQ</item>
147 <item>invGaussQ</item>
148 <item>invSigmoid</item>
149 <item>invStudentQ</item>
150 <item>length</item>
151 <item>ln</item>
152 <item>lnBeta</item>
153 <item>lnGamma</item>
154 <item>log10</item>
155 <item>log2</item>
156 <item>max</item>
157 <item>melToHertz</item>
158 <item>min</item>
159 <item>minusObject</item>
160 <item>natural</item>
161 <item>number</item>
162 <item>numberOfColumns</item>
163 <item>numberOfRows</item>
164 <item>numberOfSelected</item>
165 <item>objectsAreIdentical</item>
166 <item>option</item>
167 <item>optionMenu</item>
168 <item>pauseScript</item>
169 <item>phonToDifferenceLimens</item>
170 <item>plusObject</item>
171 <item>positive</item>
172 <item>randomBinomial</item>
173 <item>randomGauss</item>
174 <item>randomInteger</item>
175 <item>randomPoisson</item>
176 <item>randomUniform</item>
177 <item>real</item>
178 <item>readFile</item>
179 <item>removeObject</item>
180 <item>rindex</item>
181 <item>rindex_regex</item>
182 <item>round</item>
183 <item>runScript</item>
184 <item>runSystem</item>
185 <item>runSystem_nocheck</item>
186 <item>selectObject</item>
187 <item>selected</item>
188 <item>semitonesToHertz</item>
189 <item>sentence</item>
190 <item>sentencetext</item>
191 <item>sigmoid</item>
192 <item>sin</item>
193 <item>sinc</item>
194 <item>sincpi</item>
195 <item>sinh</item>
196 <item>soundPressureToPhon</item>
197 <item>sqrt</item>
198 <item>startsWith</item>
199 <item>studentP</item>
200 <item>studentQ</item>
201 <item>tan</item>
202 <item>tanh</item>
203 <item>text</item>
204 <item>variableExists</item>
205 <item>word</item>
206 <item>writeFile</item>
207 <item>writeFileLine</item>
208 <item>writeInfo</item>
209 <item>writeInfoLine</item>
210 </list>
211 <list name="functions_array">
212 <item>linear#</item>
213 <item>randomGauss#</item>
214 <item>randomInteger#</item>
215 <item>randomUniform#</item>
216 <item>zero#</item>
217 </list>
218 <list name="variables_numeric">
219 <item>all</item>
220 <item>average</item>
221 <item>e</item>
222 <item>left</item>
223 <item>macintosh</item>
224 <item>mono</item>
225 <item>pi</item>
226 <item>praatVersion</item>
227 <item>right</item>
228 <item>stereo</item>
229 <item>undefined</item>
230 <item>unix</item>
231 <item>windows</item>
232 </list>
233 <list name="variables_string">
234 <item>praatVersion$</item>
235 <item>tab$</item>
236 <item>shellDirectory$</item>
237 <item>homeDirectory$</item>
238 <item>preferencesDirectory$</item>
239 <item>newline$</item>
240 <item>temporaryDirectory$</item>
241 <item>defaultDirectory$</item>
242 </list>
243 <contexts>
244 <context name="normal" attribute="normal" lineEndContext="#pop" >
245 <DetectChar char='#' attribute="comment" context="comment" firstNonSpace="true" />
246
247 <IncludeRules context="function check" />
248
249 <DetectChar char='@' attribute="function" context="procedure name" firstNonSpace="true" />
250
251 <RegExpr String="call&B;" attribute="keyword" context="function word to shorthand arguments" firstNonSpace="true" />
252 <RegExpr String="include&B;" attribute="keyword" context="unquoted string" firstNonSpace="true" />
253
254 <RegExpr String="&B;?if&B;" attribute="keyword" beginRegion="if" />
255 <RegExpr String="endif&B;" attribute="keyword" endRegion="if" firstNonSpace="true" />
256 <RegExpr String="&B;?fi&B;" attribute="keyword" endRegion="if" />
257
258 <RegExpr String="for&B;" attribute="keyword" beginRegion="for" firstNonSpace="true" />
259 <RegExpr String="endfor&B;" attribute="keyword" endRegion="for" firstNonSpace="true" />
260
261 <RegExpr String="while&B;" attribute="keyword" beginRegion="while" firstNonSpace="true" />
262 <RegExpr String="endwhile&B;" attribute="keyword" endRegion="while" firstNonSpace="true" />
263
264 <RegExpr String="repeat&B;" attribute="keyword" beginRegion="repeat" firstNonSpace="true" />
265 <RegExpr String="until&B;" attribute="keyword" endRegion="repeat" firstNonSpace="true" />
266
267 <RegExpr String="procedure&B;" attribute="keyword" context="procedure name" beginRegion="procedure" firstNonSpace="true" />
268 <RegExpr String="endproc&B;" attribute="keyword" endRegion="procedure" firstNonSpace="true" />
269
270 <StringDetect String="select all" attribute="keyword" firstNonSpace="true" />
271 <keyword String="keywords" attribute="keyword" />
272
273 <RegExpr String="&B;(print(line|tab)?|echo|exit|asserterror|pause|send(praat|socket)|execute)&B;" attribute="keyword" context="unquoted string" />
274 <RegExpr String="&B;editor&B;" attribute="keyword" context="unquoted string" beginRegion="editor" />
275 <RegExpr String="&B;endeditor&B;" attribute="keyword" endRegion="editor" />
276
277 <RegExpr String="form&B;" attribute="keyword" context="old form definition" firstNonSpace="true" beginRegion="form" />
278
279 <RegExpr String="(goto|label)&B;" attribute="keyword" context="label" firstNonSpace="true" />
280
281 <DetectChar char='"' attribute="string" context="quoted string" />
282 <IncludeRules context="expansion" />
283
284 <IncludeRules context="operator" />
285 <IncludeRules context="variable name" />
286
287 <RegExpr String="\b[A-Z]" attribute="command" context="command" />
288
289 <DetectChar char=';' attribute="comment" context="comment" />
290 </context>
291
292 <context name="label" attribute="variable" lineEndContext="#pop" />
293
294 <context name="old form definition" attribute="string" lineEndContext="#pop!old form" />
295
296 <context name="old form" attribute="normal" lineEndContext="#stay">
297 <DetectChar char='#' attribute="comment" context="comment" firstNonSpace="true" />
298
299 <RegExpr String="(choice|optionmenu)&B;" attribute="keyword" context="normal word with colon to number" firstNonSpace="true" />
300 <RegExpr String="(option|button)&B;" attribute="keyword" context="unquoted string" firstNonSpace="true" />
301
302 <RegExpr String="(sentence|text)&B;" attribute="keyword" context="normal word to string" firstNonSpace="true" />
303
304 <RegExpr String="word&B;" attribute="keyword" context="normal word to string word" firstNonSpace="true" />
305
306 <RegExpr String="comment&B;" attribute="keyword" context="unquoted string" firstNonSpace="true" />
307
308 <RegExpr String="(real|natural|positive|integer)&B;" attribute="keyword" context="number" firstNonSpace="true" />
309
310 <RegExpr String="boolean&B;" attribute="keyword" context="normal word to variable" firstNonSpace="true" />
311
312 <RegExpr String="endform&B;" attribute="keyword" context="#pop" endRegion="form" firstNonSpace="true" />
313 </context>
314
315 <context name="operator" attribute="operator" lineEndContext="#pop" >
316 <RegExpr String="([+\/*&lt;>=!-]=?|[&amp;*|][&amp;*|]?|\^|&lt;>)" attribute="operator" />
317 <RegExpr String="\.(and|or|not|div|mod)|(and|or|not|div|mod)\." attribute="normal" />
318 <WordDetect String="and" attribute="operator" />
319 <WordDetect String="or" attribute="operator" />
320 <WordDetect String="not" attribute="operator" />
321 <WordDetect String="div" attribute="operator" />
322 <WordDetect String="mod" attribute="operator" />
323 </context>
324
325 <context name="command" attribute="command" lineEndContext="#pop" >
326 <IncludeRules context="expansion" />
327 <StringDetect String="..." attribute="command" context="shorthand arguments" />
328 <DetectChar char=":" attribute="command" context="#pop" />
329 </context>
330
331 <context name="shorthand arguments" attribute="normal" lineEndContext="#pop#pop" >
332 <IncludeRules context="variable name" />
333 <DetectChar char='"' attribute="string" context="quoted string" />
334 </context>
335
336 <context name="variable name" attribute="normal" lineEndContext="#pop" >
337 <IncludeRules context="operator" />
338 <IncludeRules context="number" />
339 <keyword String="variables_numeric" attribute="variable" />
340 <keyword String="variables_string" attribute="variable" />
341
342 <RegExpr String="\b[A-Z][a-zA-Z]+_" attribute="object.attribute" context="object reference" />
343
344 </context>
345
346 <context name="object reference" attribute="object.attribute" lineEndContext="#pop#pop" >
347 <DetectChar char="." attribute="object.attribute" context="#pop#pop!object attributes" lookAhead="true" />
348
349 <IncludeRules context="expansion" />
350
351 <DetectChar char="$" attribute="object.attribute" />
352 <DetectChar char="[" attribute="normal" context="#pop#pop" />
353 </context>
354
355 <context name="object attributes" attribute="normal" lineEndContext="#pop" >
356 <RegExpr String="\.(ncol|nrow|xmin|ymin|xmax|ymax|nx|ny|dx|dy)&B;" attribute="object.attribute" context="#pop" />
357 </context>
358
359 <context name="normal word with colon to number" attribute="normal" lineEndContext="#pop" >
360 <DetectChar char=":" attribute="normal" context="number" />
361 </context>
362
363 <context name="normal word to variable" attribute="normal" lineEndContext="#pop" >
364 <RegExpr String="\b\w+\b" attribute="normal" context="variable" />
365 </context>
366
367 <context name="variable" attribute="variable" lineEndContext="#pop" />
368
369 <context name="number" attribute="normal" lineEndContext="#pop" >
370 <IncludeRules context="operator" />
371 <RegExpr String="\b\d+(\.\d*)?([eE][-+]?\d+)?%?" attribute="number" />
372 </context>
373
374 <context name="normal word to string word" attribute="normal" lineEndContext="#pop" >
375 <RegExpr String="\b\w+\b" attribute="normal" context="string word" />
376 </context>
377
378 <context name="normal word to string" attribute="normal" lineEndContext="#pop" >
379 <RegExpr String="\b\w+\b" attribute="normal" context="unquoted string" />
380 </context>
381
382 <context name="string word" attribute="string" lineEndContext="#pop" >
383 <RegExpr String="\b\w+\b" attribute="string" context="ignore" />
384 </context>
385
386 <context name="ignore" attribute="normal" lineEndContext="#pop" />
387
388 <context name="comment" attribute="comment" lineEndContext="#pop" >
389 <DetectSpaces />
390 <IncludeRules context="##Comments" />
391 </context>
392
393 <context name="quoted string" attribute="string" lineEndContext="broken quoted string" >
394 <IncludeRules context="expansion" />
395 <DetectChar char='"' attribute="string" context="#pop" />
396 </context>
397
398 <context name="unquoted string" attribute="string" lineEndContext="broken unquoted string" >
399 <IncludeRules context="expansion" />
400 </context>
401
402 <context name="expansion" attribute="normal" lineEndContext="#pop" >
403 <RegExpr String="'[^\[\]'&quot;]+(\[([\w\d,]+|&quot;[\w\d,]+&quot;)\])?'" attribute="expansion" />
404 </context>
405
406 <context name="broken unquoted string" attribute="string" lineEndContext="#stay" >
407 <DetectSpaces attribute="normal" />
408 <StringDetect String="..." attribute="normal" context="#pop" firstNonSpace="true" />
409 <IncludeRules context="expansion" />
410 <RegExpr String="[\w\d#@;.]" context="#pop#pop" firstNonSpace="true" lookAhead="true" />
411 </context>
412
413 <context name="broken quoted string" attribute="string" lineEndContext="#stay" >
414 <IncludeRules context="broken unquoted string" />
415 <DetectChar char='"' attribute="string" context="#pop#pop" />
416 </context>
417
418 <context name="function check" attribute="normal" lineEndContext="#pop" >
419 <keyword String="functions_numeric" attribute="normal" context="numeric function check" lookAhead="true" />
420 <keyword String="functions_string" attribute="normal" context="string function check" lookAhead="true" />
421 <keyword String="functions_array" attribute="normal" context="array function check" lookAhead="true" />
422 </context>
423
424 <context name="array function check" attribute="normal" lineEndContext="#pop" >
425 <RegExpr String="[a-zA-Z0-9_]+# *[:(]" attribute="normal" context="function call" lookAhead="true" />
426 <DetectChar char=" " context="#pop#pop" />
427 </context>
428
429 <context name="string function check" attribute="normal" lineEndContext="#pop" >
430 <RegExpr String="[a-zA-Z0-9_]+\$ *[:(]" attribute="normal" context="function call" lookAhead="true" />
431 <DetectChar char=" " context="#pop#pop" />
432 </context>
433
434 <context name="numeric function check" attribute="normal" lineEndContext="#pop" >
435 <RegExpr String="[a-zA-Z0-9_]+ *[:(]" attribute="normal" context="function call" lookAhead="true" />
436 <RegExpr String="&B;editor&B;" attribute="keyword" context="#pop#pop!unquoted string" beginRegion="editor" />
437 <DetectChar char=" " context="#pop#pop" />
438 </context>
439
440 <context name="function call" attribute="function" lineEndContext="#pop" >
441 <RegExpr String="&B;beginSendPraat&B;" beginRegion="sendpraat" />
442 <RegExpr String="&B;endSendPraat&B;" endRegion="sendpraat" />
443
444 <RegExpr String="&B;beginPause&B;" beginRegion="pause" />
445 <RegExpr String="&B;endPause&B;" endRegion="pause" />
446
447 <DetectSpaces attribute="normal" />
448 <AnyChar String=":(" attribute="normal" context="#pop#pop#pop" />
449 </context>
450
451 <context name="procedure name" attribute="function" lineEndContext="#pop" >
452 <AnyChar String=":(" attribute="normal" context="#pop" />
453 <IncludeRules context="expansion" />
454 <DetectSpaces attribute="normal" context="#pop" />
455 </context>
456
457 <context name="function word to shorthand arguments" attribute="function" lineEndContext="#pop" >
458 <AnyChar String=":(" attribute="normal" context="#pop" />
459 <IncludeRules context="expansion" />
460 <DetectSpaces attribute="normal" context="#pop!shorthand arguments" />
461 </context>
462
463 </contexts>
464 <itemDatas>
465 <itemData name="normal" defStyleNum="dsNormal" />
466 <itemData name="number" defStyleNum="dsDecVal" />
467 <itemData name="object.attribute" defStyleNum="dsDecVal" />
468 <itemData name="variable" defStyleNum="dsDataType" />
469 <itemData name="keyword" defStyleNum="dsKeyword" />
470 <itemData name="expansion" defStyleNum="dsSpecialString" />
471 <itemData name="string" defStyleNum="dsString" />
472 <itemData name="command" defStyleNum="dsFunction" />
473 <itemData name="function" defStyleNum="dsFunction" />
474 <itemData name="operator" defStyleNum="dsOperator" />
475 <itemData name="comment" defStyleNum="dsComment" />
476 </itemDatas>
477 </highlighting>
478 <general>
479 <comments>
480 <comment name="singleLine" start="#" position="afterwhitespace" />
481 </comments>
482 <keywords casesensitive="true" weakDeliminator="._#$" />
483 </general>
484 </language>