Debian Codegraph @

data/syntax/brightscript.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language>
3 <language
4 name="BrightScript"
5 section="Scripts"
6 extensions="*.brs"
7 version="11"
8 kateversion="5.0"
9 author="Daniel Levin ([email protected])"
10 license="MIT">
11
12 <highlighting>
13
14
15
16
17 <list name="library"><item>library</item></list>
18
19 <list name="function"><item>function</item></list>
20 <list name="endfunction"><item>endfunction</item></list>
21 <list name="sub"><item>sub</item></list>
22 <list name="endsub"><item>endsub</item></list>
23 <list name="as"><item>as</item></list>
24
25 <list name="exit"><item>exit</item></list>
26
27 <list name="if"><item>if</item></list>
28 <list name="endif"><item>endif</item></list>
29 <list name="then"><item>then</item></list>
30 <list name="else"><item>else</item></list>
31 <list name="elseif"><item>elseif</item></list>
32
33 <list name="while"><item>while</item></list>
34 <list name="endwhile"><item>endwhile</item></list>
35 <list name="exitwhile"><item>exitwhile</item></list>
36
37 <list name="for"><item>for</item></list>
38 <list name="endfor"><item>endfor</item></list>
39 <list name="each"><item>each</item></list>
40 <list name="in"><item>in</item></list>
41 <list name="to"><item>to</item></list>
42 <list name="step"><item>step</item></list>
43 <list name="next"><item>next</item></list>
44
45 <list name="print"><item>print</item></list>
46 <list name="return"><item>return</item></list>
47
48 <list name="dim"><item>dim</item></list>
49 <list name="stop"><item>stop</item></list>
50 <list name="goto"><item>goto</item></list>
51
52 <list name="try"><item>try</item></list>
53 <list name="endtry"><item>endtry</item></list>
54 <list name="catch"><item>catch</item></list>
55 <list name="throw"><item>throw</item></list>
56
57 <list name="m"><item>m</item></list>
58 <list name="top">
59 <item>top</item>
60 <item>global</item>
61 </list>
62
63 <list name="end_of_scope">
64 <item>then</item>
65 <item>end</item>
66 <item>exit</item>
67 </list>
68
69 <list name="unary">
70 <item>not</item>
71 </list>
72
73 <list name="builtin_functions">
74 <item>tab</item>
75 <item>pos</item>
76 <item>CreateObject</item>
77 <item>Type</item>
78 <item>GetGlobalAA</item>
79 <item>Box</item>
80 <item>Run</item>
81 <item>Eval</item>
82 <item>GetLastRunCompileError</item>
83 <item>GetLastRunRuntimeError</item>
84 <item>ObjFun</item>
85 </list>
86
87 <list name="utility_functions">
88 <item>Sleep</item>
89 <item>Wait</item>
90 <item>GetInterface</item>
91 <item>FindMemberFunction</item>
92 <item>UpTime</item>
93 <item>RebootSystem</item>
94 <item>ListDir</item>
95 <item>ReadAsciiFile</item>
96 <item>WriteAsciiFile</item>
97 <item>CopyFile</item>
98 <item>MoveFile</item>
99 <item>MatchFiles</item>
100 <item>DeleteFile</item>
101 <item>DeleteDirectory</item>
102 <item>CreateDirectory</item>
103 <item>FormatDrive</item>
104 <item>StrToI</item>
105 <item>RunGarbageCollector</item>
106 <item>ParseJson</item>
107 <item>FormatJson</item>
108 <item>Tr</item>
109 </list>
110
111 <list name="string_functions">
112 <item>UCase</item>
113 <item>LCase</item>
114 <item>Asc</item>
115 <item>Chr</item>
116 <item>Instr</item>
117 <item>Left</item>
118 <item>Len</item>
119 <item>Mid</item>
120 <item>Str</item>
121 <item>StrI</item>
122 <item>String</item>
123 <item>StringI</item>
124 <item>Val</item>
125 <item>Substitute</item>
126 </list>
127
128 <list name="math_functions">
129 <item>Abs</item>
130 <item>Atn</item>
131 <item>Cdbl</item>
132 <item>Cint</item>
133 <item>Cos</item>
134 <item>Csng</item>
135 <item>Exp</item>
136 <item>Fix</item>
137 <item>Int</item>
138 <item>Log</item>
139 <item>Rnd</item>
140 <item>Sgn</item>
141 <item>Sin</item>
142 <item>Sqr</item>
143 <item>Tan</item>
144 </list>
145
146 <list name="comments">
147 <item>rem</item>
148 </list>
149
150 <list name="types">
151 <item>invalid</item>
152 <item>void</item>
153 <item>dynamic</item>
154 <item>boolean</item>
155 <item>integer</item>
156 <item>longinteger</item>
157 <item>float</item>
158 <item>double</item>
159 <item>string</item>
160 <item>object</item>
161 <item>function</item>
162 <item>interface</item>
163 </list>
164
165 <list name="constants">
166 <item>true</item>
167 <item>false</item>
168 <item>invalid</item>
169 <item>LINE_NUM</item>
170 </list>
171
172
173
174
175 <contexts>
176
177 <!-- Contexts starting with @ are for inclusion only. -->
178
179 <context name="global" attribute="g" lineEndContext="#stay">
180 <DetectSpaces/>
181 <keyword String="library" attribute="import" context="library"/>
182 <IncludeRules context="@comment"/>
183 <IncludeRules context="@macro"/>
184 <IncludeRules context="@function"/>
185 <IncludeRules context="@sub"/>
186 </context>
187
188
189 <!-- Import statement, which might appear at the global context:
190 library "mylibname.brs"
191 -->
192 <context name="library" attribute="import" lineEndContext="#pop">
193 <DetectSpaces/>
194 <DetectChar char="&quot;" attribute="string" context="#pop!string"/>
195 </context>
196
197
198 <!-- Comments have higher priority over anything else. -->
199 <context name="@comment" attribute="g" lineEndContext="#stay">
200 <DetectSpaces/>
201 <DetectChar char="'" attribute="comment" context="comment"/>
202 <keyword String="comments" attribute="comment" context="comment"/>
203 </context>
204
205 <context name="comment" attribute="comment" lineEndContext="#pop">
206 <IncludeRules context="##Comments"/>
207 </context>
208
209
210 <!-- Macro statement starts with # and might appear anywhere in the code:
211 #if foo
212 ...
213 #else
214 ...
215 #endif
216 -->
217 <context name="@macro" attribute="g" lineEndContext="#stay">
218 <DetectChar char="#" attribute="macro" context="macro_line"/>
219 </context>
220
221 <context name="macro_line" attribute="macro" lineEndContext="#pop">
222 <IncludeRules context="@comment"/>
223 </context>
224
225
226 <!-- Colon starts a new line. -->
227 <context name="line_break" attribute="g" lineEndContext="#stay">
228 <IncludeRules context="@line_break"/>
229 </context>
230
231 <context name="@line_break" attribute="g" lineEndContext="#stay">
232 <DetectChar char=":" attribute="line_break" context="#pop"/>
233 </context>
234
235
236 <!-- Common rules for function and sub. -->
237 <context name="@code_end" attribute="g" lineEndContext="#stay">
238 <RegExpr String="end\s+(if|for|while)" insensitive="true" attribute="control"/>
239 </context>
240
241 <context name="arg_as_type" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
242 <DetectSpaces/>
243 <DetectIdentifier attribute="var" context="#pop!arg_params"/>
244 </context>
245
246 <context name="arg_params" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
247 <DetectSpaces/>
248 <keyword String="as" context="as_type" lookAhead="true"/>
249 <DetectChar char="=" attribute="assign" context="rvalue"/>
250 </context>
251
252 <context name="as_type" attribute="g" lineEndContext="#stay">
253 <keyword String="as" attribute="keyword" context="as_type_value"/>
254 </context>
255
256 <context name="as_type_value" attribute="g" lineEndContext="#stay">
257 <keyword String="types" attribute="type" context="#pop#pop"/>
258 <DetectIdentifier attribute="invalid" context="#pop#pop"/>
259 </context>
260
261
262 <!-- Inline lambda call for sub/function -->
263 <context name="inline_call" attribute="g" lineEndContext="#pop">
264 <DetectSpaces/>
265 <DetectChar char="(" attribute="scope" context="#pop!lvalue_call_args"/>
266 </context>
267
268
269 <!-- Regular function definition. -->
270 <context name="@function" attribute="g" lineEndContext="#stay">
271 <keyword String="function" attribute="keyword" context="function" beginRegion="function"/>
272 </context>
273
274 <context name="function" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="function_name">
275 </context>
276
277 <context name="function_name" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!function_code">
278 <DetectSpaces/>
279 <DetectIdentifier attribute="func" context="#pop!func_open_brace"/>
280 <DetectChar char="(" context="#pop!func_open_brace" lookAhead="true"/>
281 </context>
282
283 <context name="func_open_brace" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!function_code">
284 <DetectSpaces/>
285 <DetectChar char="(" attribute="scope" context="func_args"/>
286 </context>
287
288 <context name="func_args" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop!function_code">
289 <DetectSpaces/>
290 <DetectIdentifier context="arg_as_type" lookAhead="true"/>
291 <DetectChar char=")" attribute="scope" context="#pop#pop!function_ret"/>
292 <DetectChar char="," attribute="coma" context="arg_as_type"/>
293 </context>
294
295 <context name="function_ret" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!function_code">
296 <DetectChar char=" " context="#stay"/>
297 <keyword String="as" context="as_type" lookAhead="true"/>
298 </context>
299
300 <context name="function_code" attribute="g" lineEndContext="#stay">
301 <DetectSpaces/>
302 <RegExpr String="end\s+function" insensitive="true" context="#pop!function_solid_end" lookAhead="true"/>
303 <keyword String="endfunction" context="#pop!function_solid_end" lookAhead="true"/>
304 <IncludeRules context="@code"/>
305 </context>
306
307 <context name="function_solid_end" attribute="g" lineEndContext="#stay">
308 <StringDetect String="end" insensitive="true" attribute="keyword" context="#pop!function_end"/>
309 </context>
310
311 <context name="function_end" attribute="keyword" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
312 <DetectSpaces/>
313 <StringDetect String="function" insensitive="true" attribute="keyword" context="#pop#pop!inline_call" endRegion="function"/>
314 </context>
315
316
317 <!-- sub is a function with void return type. -->
318 <context name="@sub" attribute="g" lineEndContext="#stay">
319 <keyword String="sub" attribute="keyword" context="sub" beginRegion="sub"/>
320 </context>
321
322 <context name="sub" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="sub_name">
323 </context>
324
325 <context name="sub_name" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!sub_code">
326 <DetectSpaces/>
327 <DetectIdentifier attribute="func" context="#pop!sub_open_brace"/>
328 <DetectChar char="(" context="#pop!sub_open_brace" lookAhead="true"/>
329 </context>
330
331 <context name="sub_open_brace" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!sub_code">
332 <DetectSpaces/>
333 <DetectChar char="(" attribute="scope" context="sub_args"/>
334 </context>
335
336 <context name="sub_args" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop!sub_code">
337 <DetectSpaces/>
338 <DetectIdentifier context="arg_as_type" lookAhead="true"/>
339 <DetectChar char=")" attribute="scope" context="#pop#pop!sub_ret"/>
340 <DetectChar char="," attribute="coma" context="arg_as_type"/>
341 </context>
342
343 <context name="sub_ret" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!sub_code">
344 <DetectChar char=" " context="#stay"/>
345 <keyword String="as" context="as_type" lookAhead="true"/>
346 </context>
347
348 <context name="sub_code" attribute="g" lineEndContext="#stay">
349 <DetectSpaces/>
350 <RegExpr String="end\s+sub" insensitive="true" context="#pop!sub_solid_end" lookAhead="true"/>
351 <keyword String="endsub" context="#pop!sub_solid_end" lookAhead="true"/>
352 <IncludeRules context="@code"/>
353 </context>
354
355 <context name="sub_solid_end" attribute="g" lineEndContext="#stay">
356 <StringDetect String="end" insensitive="true" attribute="keyword" context="#pop!sub_end"/>
357 </context>
358
359 <context name="sub_end" attribute="keyword" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
360 <DetectSpaces/>
361 <StringDetect String="sub" insensitive="true" attribute="keyword" context="#pop#pop!inline_call" endRegion="sub"/>
362 </context>
363
364
365 <!-- @code represents execution body, including function and sub contents.
366 -->
367 <context name="@code" attribute="g" lineEndContext="#stay">
368 <IncludeRules context="@macro"/>
369 <IncludeRules context="@comment"/>
370 <IncludeRules context="@code_end"/>
371
372 <keyword String="print" attribute="print" context="print"/>
373 <keyword String="goto" attribute="keyword" context="goto"/>
374 <keyword String="return" attribute="control" context="rvalue"/>
375 <keyword String="stop" attribute="keyword"/>
376
377 <keyword String="dim" attribute="keyword" context="dim"/>
378
379 <keyword String="if" attribute="control" context="rvalue"/>
380 <keyword String="then" attribute="control"/>
381 <keyword String="else" attribute="control"/>
382 <keyword String="elseif" attribute="control"/>
383 <keyword String="endif" attribute="control"/>
384
385 <keyword String="while" attribute="control" context="rvalue"/>
386 <keyword String="endwhile" attribute="control"/>
387 <keyword String="exitwhile" attribute="control"/>
388
389 <keyword String="for" attribute="control" context="for"/>
390 <keyword String="endfor" attribute="control"/>
391 <keyword String="next" attribute="control"/>
392
393 <keyword String="exit" attribute="control" context="exit"/>
394
395 <keyword String="try" context="try_test" lookAhead="true"/>
396 <keyword String="throw" attribute="keyword" context="rvalue"/>
397
398 <DetectChar char=":" context="line_break" lookAhead="true"/>
399
400 <DetectIdentifier context="lvalue" lookAhead="true"/>
401 </context>
402
403 <context name="try_test" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue">
404 <RegExpr String="try\s*('|$)" context="#pop!try_begin" lookAhead="true"/>
405 </context>
406
407 <context name="try_begin" attribute="g" lineEndContext="#pop">
408 <DetectIdentifier attribute="keyword" context="#pop!try_body"/>
409 </context>
410
411 <context name="try_body" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
412 <DetectSpaces/>
413 <StringDetect String="end" insensitive="true" attribute="keyword" context="#pop!try_end"/>
414 <keyword String="endtry" attribute="keyword" context="#pop"/>
415 <keyword String="catch" context="catch_test" lookAhead="true"/>
416 <IncludeRules context="@code"/>
417 </context>
418
419 <context name="try_end" attribute="g" lineEndContext="#pop">
420 <DetectSpaces/>
421 <keyword String="try" attribute="keyword" context="#pop"/>
422 </context>
423
424 <context name="catch_test" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue">
425 <RegExpr String="catch\s*[a-zA-Z_]" attribute="control" context="#pop!catch_expr" lookAhead="true"/>
426 </context>
427
428 <context name="catch_expr" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
429 <keyword String="catch" attribute="keyword" context="#pop!catch_var"/>
430 </context>
431
432 <context name="catch_var" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
433 <DetectSpaces/>
434 <DetectIdentifier attribute="var" context="#pop"/>
435 </context>
436
437 <context name="print" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="rvalue">
438 <AnyChar String=",;" attribute="coma"/>
439 <IncludeRules context="@line_break"/>
440 </context>
441
442 <context name="goto" attribute="g" lineEndContext="#pop">
443 <DetectSpaces/>
444 <DetectIdentifier attribute="label" context="#pop"/>
445 </context>
446
447 <context name="dim" attribute="g" lineEndContext="#pop">
448 <DetectSpaces/>
449 <DetectIdentifier attribute="var" context="#pop!dim_array"/>
450 <IncludeRules context="@comment"/>
451 </context>
452
453 <context name="dim_array" attribute="g" lineEndContext="#pop">
454 <DetectSpaces/>
455 <DetectChar char="[" attribute="operator" context="#pop!array"/>
456 <IncludeRules context="@comment"/>
457 </context>
458
459 <context name="for" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!for_var">
460 <DetectSpaces/>
461 <keyword String="each" attribute="control" context="#pop!for_each"/>
462 <IncludeRules context="@comment"/>
463 </context>
464
465 <context name="for_each" attribute="g" lineEndContext="#pop">
466 <DetectSpaces/>
467 <DetectIdentifier attribute="var" context="#pop!for_in"/>
468 <IncludeRules context="@comment"/>
469 </context>
470
471 <context name="for_in" attribute="g" lineEndContext="#pop">
472 <DetectSpaces/>
473 <keyword String="in" attribute="control" context="#pop!rvalue"/>
474 <IncludeRules context="@comment"/>
475 </context>
476
477 <context name="for_var" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="lvalue">
478 <DetectSpaces/>
479 <keyword String="to" attribute="control" context="#pop!for_to"/>
480 <IncludeRules context="@comment"/>
481 </context>
482
483 <context name="for_to" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="rvalue">
484 <DetectSpaces/>
485 <keyword String="step" attribute="control" context="#pop!rvalue"/>
486 </context>
487
488 <context name="exit" attribute="g" lineEndContext="#pop">
489 <DetectSpaces/>
490 <keyword String="for" attribute="control" context="#pop"/>
491 <keyword String="while" attribute="control" context="#pop"/>
492 <IncludeRules context="@comment"/>
493 </context>
494
495
496
497 <!-- Builtin functions are reserved keywords. They cannot be used as a local variable names.
498 Thus doing something like below is an error and will be highlighted with 'invalid':
499 eval = 1
500 foo = eval
501 It is still valid to use any word, including reserved ones, as an variable parameter:
502 foo.eval = 1
503 foo = bar.eval
504 foo.eval()
505 -->
506 <context name="@lvalue_builtin_functions" attribute="g" lineEndContext="#stay">
507 <keyword String="builtin_functions" context="#pop!lvalue_builtin_function" lookAhead="true"/>
508 </context>
509
510 <context name="lvalue_builtin_function" attribute="g" lineEndContext="#pop">
511 <RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!lvalue_builtin_call" lookAhead="true"/>
512 <DetectIdentifier attribute="invalid" context="#pop"/>
513 </context>
514
515 <context name="lvalue_builtin_call" attribute="g" lineEndContext="#pop">
516 <DetectIdentifier attribute="builtin_func" context="#pop!lvalue_call_open_brace"/>
517 </context>
518
519
520 <context name="@rvalue_builtin_functions" attribute="g" lineEndContext="#stay">
521 <keyword String="builtin_functions" context="#pop!rvalue_builtin_function" lookAhead="true"/>
522 </context>
523
524 <context name="rvalue_builtin_function" attribute="g" lineEndContext="#pop">
525 <RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!rvalue_builtin_call" lookAhead="true"/>
526 <DetectIdentifier attribute="invalid" context="#pop"/>
527 </context>
528
529 <context name="rvalue_builtin_call" attribute="g" lineEndContext="#pop">
530 <DetectIdentifier attribute="builtin_func" context="#pop!rvalue_call_open_brace"/>
531 </context>
532
533
534 <!-- Library functions have nothing special comparing to other functions. They just have different
535 highlighting colors. It is valid to shadow function with a variable with the same name,
536 although it is not recommended and might be considered as a warning by various linters.
537 -->
538 <context name="@lvalue_library_functions" attribute="g" lineEndContext="#stay">
539 <keyword String="utility_functions" context="#pop!lvalue_library_function" lookAhead="true"/>
540 <keyword String="string_functions" context="#pop!lvalue_library_function" lookAhead="true"/>
541 <keyword String="math_functions" context="#pop!lvalue_library_function" lookAhead="true"/>
542 </context>
543
544 <context name="lvalue_library_function" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue_var">
545 <RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!lvalue_library_call" lookAhead="true"/>
546 </context>
547
548 <context name="lvalue_library_call" attribute="g" lineEndContext="#pop">
549 <DetectIdentifier attribute="library_func" context="#pop!lvalue_call_open_brace"/>
550 </context>
551
552
553 <context name="@rvalue_library_functions" attribute="g" lineEndContext="#stay">
554 <keyword String="utility_functions" context="#pop!rvalue_library_function" lookAhead="true"/>
555 <keyword String="string_functions" context="#pop!rvalue_library_function" lookAhead="true"/>
556 <keyword String="math_functions" context="#pop!rvalue_library_function" lookAhead="true"/>
557 </context>
558
559 <context name="rvalue_library_function" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!rvalue_var">
560 <RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!rvalue_library_call" lookAhead="true"/>
561 </context>
562
563 <context name="rvalue_library_call" attribute="g" lineEndContext="#pop">
564 <DetectIdentifier attribute="library_func" context="#pop!rvalue_call_open_brace"/>
565 </context>
566
567
568 <!-- lvalue contexts represent expressions of the left side of the assignment operators or
569 standalone function calls.
570 -->
571 <context name="lvalue" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue_exp">
572 <DetectSpaces/>
573 <keyword String="m" attribute="m" context="#pop!lvalue_m_dot"/>
574 <IncludeRules context="@lvalue_builtin_functions"/>
575 <IncludeRules context="@lvalue_library_functions"/>
576 <IncludeRules context="@comment"/>
577 </context>
578
579 <context name="lvalue_exp" attribute="g" lineEndContext="#pop">
580 <DetectSpaces/>
581 <RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!lvalue_call" lookAhead="true"/>
582 <RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*:" attribute="label" context="#pop"/>
583 <DetectIdentifier context="#pop!lvalue_var" lookAhead="true"/>
584 </context>
585
586 <context name="lvalue_m_dot" attribute="g" lineEndContext="#pop">
587 <DetectSpaces/>
588 <DetectChar char="." attribute="operator" context="#pop!lvalue_top"/>
589 <IncludeRules context="@comment"/>
590 <IncludeRules context="@lvalue_ops"/>
591 </context>
592
593 <context name="lvalue_top" attribute="g" lineEndContext="#pop">
594 <DetectSpaces/>
595 <keyword String="top" attribute="top" context="#pop!lvalue_operator"/>
596 <DetectIdentifier context="#pop!lvalue_exp" lookAhead="true"/>
597 <IncludeRules context="@comment"/>
598 </context>
599
600 <context name="lvalue_var" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
601 <DetectIdentifier attribute="var" context="#pop!lvalue_var_postfix"/>
602 </context>
603
604 <context name="lvalue_var_postfix" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue_operator">
605 <AnyChar String="$%&amp;!#" attribute="var" context="#pop!lvalue_operator"/>
606 </context>
607
608 <context name="lvalue_operator" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
609 <DetectSpaces/>
610 <DetectChar char="." attribute="operator" context="#pop!lvalue_exp"/>
611 <IncludeRules context="@lvalue_ops"/>
612 </context>
613
614 <context name="@lvalue_ops" attribute="g" lineEndContext="#stay">
615 <IncludeRules context="@lvalue_call_open_brace"/>
616 <DetectChar char="[" attribute="operator" context="lvalue_array"/>
617 <RegExpr String="(=|\+=|\-=|\*=|/=|\\=|&lt;&lt;=|&gt;&gt;=)" attribute="assign" context="#pop!rvalue"/>
618 </context>
619
620 <context name="lvalue_array" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
621 <DetectSpaces/>
622 <DetectChar char="," attribute="coma"/>
623 <DetectChar char="]" attribute="operator" context="#pop!lvalue_operator"/>
624 </context>
625
626 <context name="lvalue_call" attribute="g" lineEndContext="#stay">
627 <DetectIdentifier attribute="func" context="#pop!lvalue_call_open_brace"/>
628 </context>
629
630 <context name="lvalue_call_open_brace" attribute="g" lineEndContext="#stay">
631 <IncludeRules context="@lvalue_call_open_brace"/>
632 </context>
633
634 <context name="@lvalue_call_open_brace" attribute="g" lineEndContext="#stay">
635 <DetectChar char="(" attribute="scope" context="lvalue_call_args"/>
636 </context>
637
638 <context name="lvalue_call_args" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
639 <DetectSpaces/>
640 <DetectChar char=")" attribute="scope" context="#pop#pop!lvalue_operator"/>
641 <DetectChar char="," attribute="coma"/>
642 </context>
643
644
645 <!-- rvalue contexts represent expressions on the right side of assignment operators and arguments
646 to other functions, 'print' calls, object keys, array values, etc.
647 -->
648 <context name="rvalue" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
649 <DetectSpaces/>
650 <AnyChar String="-+" attribute="unary"/>
651 <IncludeRules context="@comment"/>
652 <IncludeRules context="@function"/>
653 <IncludeRules context="@sub"/>
654 <keyword String="unary" attribute="unary"/>
655 <keyword String="end_of_scope" context="#pop#pop" lookAhead="true"/>
656 <DetectChar char="&quot;" attribute="string" context="#pop!string"/>
657 <DetectChar char="[" attribute="operator" context="#pop!array"/>
658 <DetectChar char="(" attribute="scope" context="#pop!rvalue_scope"/>
659 <DetectChar char="{" attribute="operator" context="#pop!object"/>
660 <keyword String="constants" attribute="constant" context="#pop!rvalue_operator"/>
661 <RegExpr String="[-+]?[0-9]*\.[0-9]" context="#pop!float" lookAhead="true"/>
662 <RegExpr String="[-+]?[0-9]" context="#pop!int" lookAhead="true"/>
663 <StringDetect String="&amp;h" insensitive="true" attribute="dec" context="#pop!hex"/>
664 <keyword String="m" attribute="m" context="#pop!rvalue_m_dot"/>
665 <IncludeRules context="@rvalue_builtin_functions"/>
666 <IncludeRules context="@rvalue_library_functions"/>
667 <IncludeRules context="@rvalue_dot"/>
668 </context>
669
670 <context name="rvalue_var" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
671 <DetectIdentifier attribute="var" context="#pop!rvalue_var_postfix"/>
672 </context>
673
674 <context name="rvalue_var_postfix" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!rvalue_operator">
675 <AnyChar String="$%&amp;!#" attribute="var" context="#pop!rvalue_operator"/>
676 </context>
677
678 <context name="rvalue_operator" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!rvalue_end">
679 <DetectSpaces/>
680 <AnyChar String=".@" attribute="operator" context="#pop!rvalue_dot"/>
681 <IncludeRules context="@rvalue_ops"/>
682 </context>
683
684 <context name="@rvalue_ops" attribute="g" lineEndContext="#stay">
685 <IncludeRules context="@rvalue_call_open_brace"/>
686 <DetectChar char="[" attribute="operator" context="#pop!array"/>
687 </context>
688
689 <context name="rvalue_end" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
690 <DetectSpaces/>
691 <RegExpr String="=|&lt;&gt;|&lt;&lt;|&gt;&gt;|&lt;=|&gt;=|&lt;|&gt;|\^|\-|\+|\*|\/|\\|(and|or|mod)(?=\W)" insensitive="true" attribute="binary" context="#pop!rvalue"/>
692 </context>
693
694 <context name="rvalue_m_dot" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!rvalue_end">
695 <DetectSpaces/>
696 <DetectChar char="." attribute="operator" context="#pop!rvalue_top"/>
697 <IncludeRules context="@comment"/>
698 <IncludeRules context="@rvalue_ops"/>
699 </context>
700
701 <context name="rvalue_top" attribute="g" lineEndContext="#pop">
702 <DetectSpaces/>
703 <keyword String="top" attribute="top" context="#pop!rvalue_operator"/>
704 <DetectIdentifier context="#pop!rvalue_dot" lookAhead="true"/>
705 <IncludeRules context="@comment"/>
706 </context>
707
708 <context name="rvalue_scope" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
709 <DetectSpaces/>
710 <DetectChar char=")" attribute="scope" context="#pop!rvalue_operator"/>
711 </context>
712
713 <context name="rvalue_dot" attribute="g" lineEndContext="#stay">
714 <IncludeRules context="@rvalue_dot"/>
715 </context>
716
717 <context name="@rvalue_dot" attribute="g" lineEndContext="#stay">
718 <RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!rvalue_call" lookAhead="true"/>
719 <DetectIdentifier context="#pop!rvalue_var" lookAhead="true"/>
720 </context>
721
722
723 <!-- Other rvalue expressions. -->
724 <context name="string" attribute="string" lineEndContext="#pop#pop">
725 <DetectChar char="&quot;" attribute="string" context="#pop!rvalue_operator"/>
726 </context>
727
728 <context name="array" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
729 <DetectSpaces/>
730 <DetectChar char="," attribute="coma"/>
731 <DetectChar char="]" attribute="operator" context="#pop!rvalue_operator"/>
732 </context>
733
734 <context name="object" attribute="g" lineEndContext="#stay">
735 <DetectSpaces/>
736 <IncludeRules context="@comment"/>
737 <DetectChar char="," attribute="coma"/>
738 <DetectChar char="}" attribute="operator" context="#pop!rvalue_operator"/>
739 <DetectChar char="&quot;" attribute="var" context="object_param_string"/>
740 <DetectIdentifier attribute="var" context="object_param_colon"/>
741 </context>
742
743 <context name="object_param_string" attribute="var" lineEndContext="#pop">
744 <DetectChar char="&quot;" attribute="var" context="#pop!object_param_colon"/>
745 </context>
746
747 <context name="object_param_colon" attribute="g" lineEndContext="#pop">
748 <DetectSpaces/>
749 <IncludeRules context="@comment"/>
750 <DetectChar char=":" attribute="operator" context="#pop!rvalue"/>
751 </context>
752
753 <context name="float" attribute="float" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
754 <!-- documentation says this is a valid string, but implementation gives compile error -->
755 <!--<RegExpr String="[-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?\$" attribute="string" context="postfix_delimiter"/>-->
756 <!--<RegExpr String="[-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?[%&amp;]" attribute="dec" context="postfix_delimiter"/>-->
757 <RegExpr String="[-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?[!#]?" attribute="float" context="postfix_delimiter"/>
758 </context>
759
760 <context name="int" attribute="dec" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
761 <!-- documentation says this is a valid string, but implementation gives compile error -->
762 <!--<RegExpr String="[-+]?[0-9]*\$" attribute="string" context="postfix_delimiter"/>-->
763 <RegExpr String="[-+]?[0-9]*[!#]" attribute="float" context="postfix_delimiter"/>
764 <RegExpr String="[-+]?[0-9]*[%&amp;]?" attribute="dec" context="postfix_delimiter"/>
765 </context>
766
767 <context name="hex" attribute="invalid" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
768 <RegExpr String="[0-9a-fA-F]+" insensitive="true" attribute="dec" context="#pop"/>
769 </context>
770
771 <context name="postfix_delimiter" attribute="g" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
772 <RegExpr String="[\s\W]" context="#pop#pop!rvalue_operator" lookAhead="true"/>
773 </context>
774
775 <context name="rvalue_call" attribute="g" lineEndContext="#stay">
776 <DetectIdentifier attribute="func" context="#pop!rvalue_call_open_brace"/>
777 </context>
778
779 <context name="rvalue_call_open_brace" attribute="g" lineEndContext="#stay">
780 <IncludeRules context="@rvalue_call_open_brace"/>
781 </context>
782
783 <context name="@rvalue_call_open_brace" attribute="g" lineEndContext="#stay">
784 <DetectChar char="(" attribute="scope" context="rvalue_call_args"/>
785 </context>
786
787 <context name="rvalue_call_args" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
788 <DetectSpaces/>
789 <DetectChar char=")" attribute="scope" context="#pop#pop!rvalue_operator"/>
790 <DetectChar char="," attribute="coma"/>
791 </context>
792
793 </contexts>
794
795
796
797
798 <itemDatas>
799 <itemData name="g" defStyleNum="dsNormal"/>
800 <itemData name="import" defStyleNum="dsImport"/>
801 <itemData name="func" defStyleNum="dsFunction"/>
802 <itemData name="keyword" defStyleNum="dsKeyword"/>
803 <itemData name="control" defStyleNum="dsControlFlow"/>
804 <itemData name="assign" defStyleNum="dsOperator"/>
805 <itemData name="binary" defStyleNum="dsOperator"/>
806 <itemData name="unary" defStyleNum="dsOperator"/>
807 <itemData name="operator" defStyleNum="dsOperator"/>
808 <itemData name="scope" defStyleNum="dsOperator"/>
809 <itemData name="coma" defStyleNum="dsOperator"/>
810 <itemData name="type" defStyleNum="dsDataType"/>
811 <itemData name="var" defStyleNum="dsVariable"/>
812 <itemData name="comment" defStyleNum="dsComment"/>
813 <itemData name="print" defStyleNum="dsBuiltIn"/>
814 <itemData name="builtin_func" defStyleNum="dsBuiltIn"/>
815 <itemData name="library_func" defStyleNum="dsBuiltIn"/>
816 <itemData name="dec" defStyleNum="dsDecVal"/>
817 <itemData name="float" defStyleNum="dsFloat"/>
818 <itemData name="string" defStyleNum="dsString"/>
819 <itemData name="constant" defStyleNum="dsConstant"/>
820 <itemData name="macro" defStyleNum="dsPreprocessor"/>
821 <itemData name="label" defStyleNum="dsSpecialChar"/>
822 <itemData name="line_break" defStyleNum="dsSpecialChar"/>
823 <itemData name="m" defStyleNum="dsExtension"/>
824 <itemData name="top" defStyleNum="dsExtension"/>
825 <itemData name="invalid" defStyleNum="dsError"/>
826 </itemDatas>
827
828 </highlighting>
829
830
831
832
833 <general>
834 <comments>
835 <comment name="singleLine" start="'"/>
836 </comments>
837
838 <keywords casesensitive="0" additionalDeliminator="'"/>
839 </general>
840
841 </language>
842 <!-- kate: replace-tabs off; -->