File: brightscript.xml

package info (click to toggle)
kf6-syntax-highlighting 6.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 47,568 kB
  • sloc: xml: 197,750; cpp: 12,850; python: 3,023; sh: 955; perl: 546; ruby: 488; pascal: 393; javascript: 161; php: 150; jsp: 132; lisp: 131; haskell: 124; ada: 119; ansic: 107; makefile: 96; f90: 94; ml: 85; cobol: 81; yacc: 71; csh: 62; erlang: 54; sql: 51; java: 47; objc: 37; awk: 31; asm: 30; tcl: 29; fortran: 18; cs: 10
file content (842 lines) | stat: -rw-r--r-- 31,660 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language>
<language
	name="BrightScript"
	section="Scripts"
	extensions="*.brs"
	version="11"
	kateversion="5.0"
	author="Daniel Levin (dendy.ua@gmail.com)"
	license="MIT">

<highlighting>




<list name="library"><item>library</item></list>

<list name="function"><item>function</item></list>
<list name="endfunction"><item>endfunction</item></list>
<list name="sub"><item>sub</item></list>
<list name="endsub"><item>endsub</item></list>
<list name="as"><item>as</item></list>

<list name="exit"><item>exit</item></list>

<list name="if"><item>if</item></list>
<list name="endif"><item>endif</item></list>
<list name="then"><item>then</item></list>
<list name="else"><item>else</item></list>
<list name="elseif"><item>elseif</item></list>

<list name="while"><item>while</item></list>
<list name="endwhile"><item>endwhile</item></list>
<list name="exitwhile"><item>exitwhile</item></list>

<list name="for"><item>for</item></list>
<list name="endfor"><item>endfor</item></list>
<list name="each"><item>each</item></list>
<list name="in"><item>in</item></list>
<list name="to"><item>to</item></list>
<list name="step"><item>step</item></list>
<list name="next"><item>next</item></list>

<list name="print"><item>print</item></list>
<list name="return"><item>return</item></list>

<list name="dim"><item>dim</item></list>
<list name="stop"><item>stop</item></list>
<list name="goto"><item>goto</item></list>

<list name="try"><item>try</item></list>
<list name="endtry"><item>endtry</item></list>
<list name="catch"><item>catch</item></list>
<list name="throw"><item>throw</item></list>

<list name="m"><item>m</item></list>
<list name="top">
	<item>top</item>
	<item>global</item>
</list>

<list name="end_of_scope">
	<item>then</item>
	<item>end</item>
	<item>exit</item>
</list>

<list name="unary">
	<item>not</item>
</list>

<list name="builtin_functions">
	<item>tab</item>
	<item>pos</item>
	<item>CreateObject</item>
	<item>Type</item>
	<item>GetGlobalAA</item>
	<item>Box</item>
	<item>Run</item>
	<item>Eval</item>
	<item>GetLastRunCompileError</item>
	<item>GetLastRunRuntimeError</item>
	<item>ObjFun</item>
</list>

<list name="utility_functions">
	<item>Sleep</item>
	<item>Wait</item>
	<item>GetInterface</item>
	<item>FindMemberFunction</item>
	<item>UpTime</item>
	<item>RebootSystem</item>
	<item>ListDir</item>
	<item>ReadAsciiFile</item>
	<item>WriteAsciiFile</item>
	<item>CopyFile</item>
	<item>MoveFile</item>
	<item>MatchFiles</item>
	<item>DeleteFile</item>
	<item>DeleteDirectory</item>
	<item>CreateDirectory</item>
	<item>FormatDrive</item>
	<item>StrToI</item>
	<item>RunGarbageCollector</item>
	<item>ParseJson</item>
	<item>FormatJson</item>
	<item>Tr</item>
</list>

<list name="string_functions">
	<item>UCase</item>
	<item>LCase</item>
	<item>Asc</item>
	<item>Chr</item>
	<item>Instr</item>
	<item>Left</item>
	<item>Len</item>
	<item>Mid</item>
	<item>Str</item>
	<item>StrI</item>
	<item>String</item>
	<item>StringI</item>
	<item>Val</item>
	<item>Substitute</item>
</list>

<list name="math_functions">
	<item>Abs</item>
	<item>Atn</item>
	<item>Cdbl</item>
	<item>Cint</item>
	<item>Cos</item>
	<item>Csng</item>
	<item>Exp</item>
	<item>Fix</item>
	<item>Int</item>
	<item>Log</item>
	<item>Rnd</item>
	<item>Sgn</item>
	<item>Sin</item>
	<item>Sqr</item>
	<item>Tan</item>
</list>

<list name="comments">
	<item>rem</item>
</list>

<list name="types">
	<item>invalid</item>
	<item>void</item>
	<item>dynamic</item>
	<item>boolean</item>
	<item>integer</item>
	<item>longinteger</item>
	<item>float</item>
	<item>double</item>
	<item>string</item>
	<item>object</item>
	<item>function</item>
	<item>interface</item>
</list>

<list name="constants">
	<item>true</item>
	<item>false</item>
	<item>invalid</item>
	<item>LINE_NUM</item>
</list>




<contexts>

<!-- Contexts starting with @ are for inclusion only. -->

<context name="global" attribute="g" lineEndContext="#stay">
	<DetectSpaces/>
	<keyword String="library" attribute="import" context="library"/>
	<IncludeRules context="@comment"/>
	<IncludeRules context="@macro"/>
	<IncludeRules context="@function"/>
	<IncludeRules context="@sub"/>
</context>


<!-- Import statement, which might appear at the global context:
         library "mylibname.brs"
-->
<context name="library" attribute="import" lineEndContext="#pop">
	<DetectSpaces/>
	<DetectChar char="&quot;" attribute="string" context="#pop!string"/>
</context>


<!-- Comments have higher priority over anything else. -->
<context name="@comment" attribute="g" lineEndContext="#stay">
	<DetectSpaces/>
	<DetectChar char="'" attribute="comment" context="comment"/>
	<keyword String="comments" attribute="comment" context="comment"/>
</context>

<context name="comment" attribute="comment" lineEndContext="#pop">
	<IncludeRules context="##Comments"/>
</context>


<!-- Macro statement starts with # and might appear anywhere in the code:
         #if foo
             ...
         #else
             ...
         #endif
-->
<context name="@macro" attribute="g" lineEndContext="#stay">
	<DetectChar char="#" attribute="macro" context="macro_line"/>
</context>

<context name="macro_line" attribute="macro" lineEndContext="#pop">
	<IncludeRules context="@comment"/>
</context>


<!-- Colon starts a new line. -->
<context name="line_break" attribute="g" lineEndContext="#stay">
	<IncludeRules context="@line_break"/>
</context>

<context name="@line_break" attribute="g" lineEndContext="#stay">
	<DetectChar char=":" attribute="line_break" context="#pop"/>
</context>


<!-- Common rules for function and sub. -->
<context name="@code_end" attribute="g" lineEndContext="#stay">
	<RegExpr String="end\s+(if|for|while)" insensitive="true" attribute="control"/>
</context>

<context name="arg_as_type" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
	<DetectSpaces/>
	<DetectIdentifier attribute="var" context="#pop!arg_params"/>
</context>

<context name="arg_params" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
	<DetectSpaces/>
	<keyword String="as" context="as_type" lookAhead="true"/>
	<DetectChar char="=" attribute="assign" context="rvalue"/>
</context>

<context name="as_type" attribute="g" lineEndContext="#stay">
	<keyword String="as" attribute="keyword" context="as_type_value"/>
</context>

<context name="as_type_value" attribute="g" lineEndContext="#stay">
	<keyword String="types" attribute="type" context="#pop#pop"/>
	<DetectIdentifier attribute="invalid" context="#pop#pop"/>
</context>


<!-- Inline lambda call for sub/function -->
<context name="inline_call" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<DetectChar char="(" attribute="scope" context="#pop!lvalue_call_args"/>
</context>


<!-- Regular function definition. -->
<context name="@function" attribute="g" lineEndContext="#stay">
	<keyword String="function" attribute="keyword" context="function" beginRegion="function"/>
</context>

<context name="function" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="function_name">
</context>

<context name="function_name" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!function_code">
	<DetectSpaces/>
	<DetectIdentifier attribute="func" context="#pop!func_open_brace"/>
	<DetectChar char="(" context="#pop!func_open_brace" lookAhead="true"/>
</context>

<context name="func_open_brace" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!function_code">
	<DetectSpaces/>
	<DetectChar char="(" attribute="scope" context="func_args"/>
</context>

<context name="func_args" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop!function_code">
	<DetectSpaces/>
	<DetectIdentifier context="arg_as_type" lookAhead="true"/>
	<DetectChar char=")" attribute="scope" context="#pop#pop!function_ret"/>
	<DetectChar char="," attribute="coma" context="arg_as_type"/>
</context>

<context name="function_ret" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!function_code">
	<DetectChar char=" " context="#stay"/>
	<keyword String="as" context="as_type" lookAhead="true"/>
</context>

<context name="function_code" attribute="g" lineEndContext="#stay">
	<DetectSpaces/>
	<RegExpr String="end\s+function" insensitive="true" context="#pop!function_solid_end" lookAhead="true"/>
	<keyword String="endfunction" context="#pop!function_solid_end" lookAhead="true"/>
	<IncludeRules context="@code"/>
</context>

<context name="function_solid_end" attribute="g" lineEndContext="#stay">
	<StringDetect String="end" insensitive="true" attribute="keyword" context="#pop!function_end"/>
</context>

<context name="function_end" attribute="keyword" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
	<DetectSpaces/>
	<StringDetect String="function" insensitive="true" attribute="keyword" context="#pop#pop!inline_call" endRegion="function"/>
</context>


<!-- sub is a function with void return type. -->
<context name="@sub" attribute="g" lineEndContext="#stay">
	<keyword String="sub" attribute="keyword" context="sub" beginRegion="sub"/>
</context>

<context name="sub" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="sub_name">
</context>

<context name="sub_name" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!sub_code">
	<DetectSpaces/>
	<DetectIdentifier attribute="func" context="#pop!sub_open_brace"/>
	<DetectChar char="(" context="#pop!sub_open_brace" lookAhead="true"/>
</context>

<context name="sub_open_brace" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!sub_code">
	<DetectSpaces/>
	<DetectChar char="(" attribute="scope" context="sub_args"/>
</context>

<context name="sub_args" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop#pop!sub_code">
	<DetectSpaces/>
	<DetectIdentifier context="arg_as_type" lookAhead="true"/>
	<DetectChar char=")" attribute="scope" context="#pop#pop!sub_ret"/>
	<DetectChar char="," attribute="coma" context="arg_as_type"/>
</context>

<context name="sub_ret" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!sub_code">
	<DetectChar char=" " context="#stay"/>
	<keyword String="as" context="as_type" lookAhead="true"/>
</context>

<context name="sub_code" attribute="g" lineEndContext="#stay">
	<DetectSpaces/>
	<RegExpr String="end\s+sub" insensitive="true" context="#pop!sub_solid_end" lookAhead="true"/>
	<keyword String="endsub" context="#pop!sub_solid_end" lookAhead="true"/>
	<IncludeRules context="@code"/>
</context>

<context name="sub_solid_end" attribute="g" lineEndContext="#stay">
	<StringDetect String="end" insensitive="true" attribute="keyword" context="#pop!sub_end"/>
</context>

<context name="sub_end" attribute="keyword" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
	<DetectSpaces/>
	<StringDetect String="sub" insensitive="true" attribute="keyword" context="#pop#pop!inline_call" endRegion="sub"/>
</context>


<!-- @code represents execution body, including function and sub contents.
-->
<context name="@code" attribute="g" lineEndContext="#stay">
	<IncludeRules context="@macro"/>
	<IncludeRules context="@comment"/>
	<IncludeRules context="@code_end"/>

	<keyword String="print" attribute="print" context="print"/>
	<keyword String="goto" attribute="keyword" context="goto"/>
	<keyword String="return" attribute="control" context="rvalue"/>
	<keyword String="stop" attribute="keyword"/>

	<keyword String="dim" attribute="keyword" context="dim"/>

	<keyword String="if" attribute="control" context="rvalue"/>
	<keyword String="then" attribute="control"/>
	<keyword String="else" attribute="control"/>
	<keyword String="elseif" attribute="control"/>
	<keyword String="endif" attribute="control"/>

	<keyword String="while" attribute="control" context="rvalue"/>
	<keyword String="endwhile" attribute="control"/>
	<keyword String="exitwhile" attribute="control"/>

	<keyword String="for" attribute="control" context="for"/>
	<keyword String="endfor" attribute="control"/>
	<keyword String="next" attribute="control"/>

	<keyword String="exit" attribute="control" context="exit"/>

	<keyword String="try" context="try_test" lookAhead="true"/>
	<keyword String="throw" attribute="keyword" context="rvalue"/>

	<DetectChar char=":" context="line_break" lookAhead="true"/>

	<DetectIdentifier context="lvalue" lookAhead="true"/>
</context>

<context name="try_test" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue">
	<RegExpr String="try\s*('|$)" context="#pop!try_begin" lookAhead="true"/>
</context>

<context name="try_begin" attribute="g" lineEndContext="#pop">
	<DetectIdentifier attribute="keyword" context="#pop!try_body"/>
</context>

<context name="try_body" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
	<DetectSpaces/>
	<StringDetect String="end" insensitive="true" attribute="keyword" context="#pop!try_end"/>
	<keyword String="endtry" attribute="keyword" context="#pop"/>
	<keyword String="catch" context="catch_test" lookAhead="true"/>
	<IncludeRules context="@code"/>
</context>

<context name="try_end" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<keyword String="try" attribute="keyword" context="#pop"/>
</context>

<context name="catch_test" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue">
	<RegExpr String="catch\s*[a-zA-Z_]" attribute="control" context="#pop!catch_expr" lookAhead="true"/>
</context>

<context name="catch_expr" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<keyword String="catch" attribute="keyword" context="#pop!catch_var"/>
</context>

<context name="catch_var" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<DetectSpaces/>
	<DetectIdentifier attribute="var" context="#pop"/>
</context>

<context name="print" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="rvalue">
	<AnyChar String=",;" attribute="coma"/>
	<IncludeRules context="@line_break"/>
</context>

<context name="goto" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<DetectIdentifier attribute="label" context="#pop"/>
</context>

<context name="dim" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<DetectIdentifier attribute="var" context="#pop!dim_array"/>
	<IncludeRules context="@comment"/>
</context>

<context name="dim_array" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<DetectChar char="[" attribute="operator" context="#pop!array"/>
	<IncludeRules context="@comment"/>
</context>

<context name="for" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!for_var">
	<DetectSpaces/>
	<keyword String="each" attribute="control" context="#pop!for_each"/>
	<IncludeRules context="@comment"/>
</context>

<context name="for_each" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<DetectIdentifier attribute="var" context="#pop!for_in"/>
	<IncludeRules context="@comment"/>
</context>

<context name="for_in" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<keyword String="in" attribute="control" context="#pop!rvalue"/>
	<IncludeRules context="@comment"/>
</context>

<context name="for_var" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="lvalue">
	<DetectSpaces/>
	<keyword String="to" attribute="control" context="#pop!for_to"/>
	<IncludeRules context="@comment"/>
</context>

<context name="for_to" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="rvalue">
	<DetectSpaces/>
	<keyword String="step" attribute="control" context="#pop!rvalue"/>
</context>

<context name="exit" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<keyword String="for" attribute="control" context="#pop"/>
	<keyword String="while" attribute="control" context="#pop"/>
	<IncludeRules context="@comment"/>
</context>



<!-- Builtin functions are reserved keywords. They cannot be used as a local variable names.
     Thus doing something like below is an error and will be highlighted with 'invalid':
         eval = 1
         foo = eval
     It is still valid to use any word, including reserved ones, as an variable parameter:
         foo.eval = 1
         foo = bar.eval
         foo.eval()
-->
<context name="@lvalue_builtin_functions" attribute="g" lineEndContext="#stay">
    <keyword String="builtin_functions" context="#pop!lvalue_builtin_function" lookAhead="true"/>
</context>

<context name="lvalue_builtin_function" attribute="g" lineEndContext="#pop">
	<RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!lvalue_builtin_call" lookAhead="true"/>
	<DetectIdentifier attribute="invalid" context="#pop"/>
</context>

<context name="lvalue_builtin_call" attribute="g" lineEndContext="#pop">
	<DetectIdentifier attribute="builtin_func" context="#pop!lvalue_call_open_brace"/>
</context>


<context name="@rvalue_builtin_functions" attribute="g" lineEndContext="#stay">
    <keyword String="builtin_functions" context="#pop!rvalue_builtin_function" lookAhead="true"/>
</context>

<context name="rvalue_builtin_function" attribute="g" lineEndContext="#pop">
	<RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!rvalue_builtin_call" lookAhead="true"/>
	<DetectIdentifier attribute="invalid" context="#pop"/>
</context>

<context name="rvalue_builtin_call" attribute="g" lineEndContext="#pop">
	<DetectIdentifier attribute="builtin_func" context="#pop!rvalue_call_open_brace"/>
</context>


<!-- Library functions have nothing special comparing to other functions. They just have different
     highlighting colors. It is valid to shadow function with a variable with the same name,
     although it is not recommended and might be considered as a warning by various linters.
-->
<context name="@lvalue_library_functions" attribute="g" lineEndContext="#stay">
	<keyword String="utility_functions" context="#pop!lvalue_library_function" lookAhead="true"/>
	<keyword String="string_functions" context="#pop!lvalue_library_function" lookAhead="true"/>
	<keyword String="math_functions" context="#pop!lvalue_library_function" lookAhead="true"/>
</context>

<context name="lvalue_library_function" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue_var">
	<RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!lvalue_library_call" lookAhead="true"/>
</context>

<context name="lvalue_library_call" attribute="g" lineEndContext="#pop">
	<DetectIdentifier attribute="library_func" context="#pop!lvalue_call_open_brace"/>
</context>


<context name="@rvalue_library_functions" attribute="g" lineEndContext="#stay">
	<keyword String="utility_functions" context="#pop!rvalue_library_function" lookAhead="true"/>
	<keyword String="string_functions" context="#pop!rvalue_library_function" lookAhead="true"/>
	<keyword String="math_functions" context="#pop!rvalue_library_function" lookAhead="true"/>
</context>

<context name="rvalue_library_function" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!rvalue_var">
	<RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!rvalue_library_call" lookAhead="true"/>
</context>

<context name="rvalue_library_call" attribute="g" lineEndContext="#pop">
	<DetectIdentifier attribute="library_func" context="#pop!rvalue_call_open_brace"/>
</context>


<!-- lvalue contexts represent expressions of the left side of the assignment operators or
	 standalone function calls.
-->
<context name="lvalue" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue_exp">
	<DetectSpaces/>
	<keyword String="m" attribute="m" context="#pop!lvalue_m_dot"/>
	<IncludeRules context="@lvalue_builtin_functions"/>
	<IncludeRules context="@lvalue_library_functions"/>
	<IncludeRules context="@comment"/>
</context>

<context name="lvalue_exp" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!lvalue_call" lookAhead="true"/>
	<RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*:" attribute="label" context="#pop"/>
	<DetectIdentifier context="#pop!lvalue_var" lookAhead="true"/>
</context>

<context name="lvalue_m_dot" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<DetectChar char="." attribute="operator" context="#pop!lvalue_top"/>
	<IncludeRules context="@comment"/>
	<IncludeRules context="@lvalue_ops"/>
</context>

<context name="lvalue_top" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<keyword String="top" attribute="top" context="#pop!lvalue_operator"/>
	<DetectIdentifier context="#pop!lvalue_exp" lookAhead="true"/>
	<IncludeRules context="@comment"/>
</context>

<context name="lvalue_var" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<DetectIdentifier attribute="var" context="#pop!lvalue_var_postfix"/>
</context>

<context name="lvalue_var_postfix" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!lvalue_operator">
	<AnyChar String="$%&amp;!#" attribute="var" context="#pop!lvalue_operator"/>
</context>

<context name="lvalue_operator" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<DetectSpaces/>
	<DetectChar char="." attribute="operator" context="#pop!lvalue_exp"/>
	<IncludeRules context="@lvalue_ops"/>
</context>

<context name="@lvalue_ops" attribute="g" lineEndContext="#stay">
	<IncludeRules context="@lvalue_call_open_brace"/>
	<DetectChar char="[" attribute="operator" context="lvalue_array"/>
	<RegExpr String="(=|\+=|\-=|\*=|/=|\\=|&lt;&lt;=|&gt;&gt;=)" attribute="assign" context="#pop!rvalue"/>
</context>

<context name="lvalue_array" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
	<DetectSpaces/>
	<DetectChar char="," attribute="coma"/>
	<DetectChar char="]" attribute="operator" context="#pop!lvalue_operator"/>
</context>

<context name="lvalue_call" attribute="g" lineEndContext="#stay">
	<DetectIdentifier attribute="func" context="#pop!lvalue_call_open_brace"/>
</context>

<context name="lvalue_call_open_brace" attribute="g" lineEndContext="#stay">
	<IncludeRules context="@lvalue_call_open_brace"/>
</context>

<context name="@lvalue_call_open_brace" attribute="g" lineEndContext="#stay">
	<DetectChar char="(" attribute="scope" context="lvalue_call_args"/>
</context>

<context name="lvalue_call_args" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
	<DetectSpaces/>
	<DetectChar char=")" attribute="scope" context="#pop#pop!lvalue_operator"/>
	<DetectChar char="," attribute="coma"/>
</context>


<!-- rvalue contexts represent expressions on the right side of assignment operators and arguments
	 to other functions, 'print' calls, object keys, array values, etc.
-->
<context name="rvalue" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<DetectSpaces/>
	<AnyChar String="-+" attribute="unary"/>
	<IncludeRules context="@comment"/>
	<IncludeRules context="@function"/>
	<IncludeRules context="@sub"/>
	<keyword String="unary" attribute="unary"/>
	<keyword String="end_of_scope" context="#pop#pop" lookAhead="true"/>
	<DetectChar char="&quot;" attribute="string" context="#pop!string"/>
	<DetectChar char="[" attribute="operator" context="#pop!array"/>
	<DetectChar char="(" attribute="scope" context="#pop!rvalue_scope"/>
	<DetectChar char="{" attribute="operator" context="#pop!object"/>
	<keyword String="constants" attribute="constant" context="#pop!rvalue_operator"/>
	<RegExpr String="[-+]?[0-9]*\.[0-9]" context="#pop!float" lookAhead="true"/>
	<RegExpr String="[-+]?[0-9]" context="#pop!int" lookAhead="true"/>
	<StringDetect String="&amp;h" insensitive="true" attribute="dec" context="#pop!hex"/>
	<keyword String="m" attribute="m" context="#pop!rvalue_m_dot"/>
	<IncludeRules context="@rvalue_builtin_functions"/>
	<IncludeRules context="@rvalue_library_functions"/>
	<IncludeRules context="@rvalue_dot"/>
</context>

<context name="rvalue_var" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
	<DetectIdentifier attribute="var" context="#pop!rvalue_var_postfix"/>
</context>

<context name="rvalue_var_postfix" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!rvalue_operator">
	<AnyChar String="$%&amp;!#" attribute="var" context="#pop!rvalue_operator"/>
</context>

<context name="rvalue_operator" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!rvalue_end">
	<DetectSpaces/>
	<AnyChar String=".@" attribute="operator" context="#pop!rvalue_dot"/>
	<IncludeRules context="@rvalue_ops"/>
</context>

<context name="@rvalue_ops" attribute="g" lineEndContext="#stay">
	<IncludeRules context="@rvalue_call_open_brace"/>
	<DetectChar char="[" attribute="operator" context="#pop!array"/>
</context>

<context name="rvalue_end" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<DetectSpaces/>
	<RegExpr String="=|&lt;&gt;|&lt;&lt;|&gt;&gt;|&lt;=|&gt;=|&lt;|&gt;|\^|\-|\+|\*|\/|\\|(and|or|mod)(?=\W)" insensitive="true" attribute="binary" context="#pop!rvalue"/>
</context>

<context name="rvalue_m_dot" attribute="g" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!rvalue_end">
	<DetectSpaces/>
	<DetectChar char="." attribute="operator" context="#pop!rvalue_top"/>
	<IncludeRules context="@comment"/>
	<IncludeRules context="@rvalue_ops"/>
</context>

<context name="rvalue_top" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<keyword String="top" attribute="top" context="#pop!rvalue_operator"/>
	<DetectIdentifier context="#pop!rvalue_dot" lookAhead="true"/>
	<IncludeRules context="@comment"/>
</context>

<context name="rvalue_scope" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
	<DetectSpaces/>
	<DetectChar char=")" attribute="scope" context="#pop!rvalue_operator"/>
</context>

<context name="rvalue_dot" attribute="g" lineEndContext="#stay">
	<IncludeRules context="@rvalue_dot"/>
</context>

<context name="@rvalue_dot" attribute="g" lineEndContext="#stay">
	<RegExpr String="[a-zA-Z_][a-zA-Z0-1_]*\s*\(" context="#pop!rvalue_call" lookAhead="true"/>
	<DetectIdentifier context="#pop!rvalue_var" lookAhead="true"/>
</context>


<!-- Other rvalue expressions. -->
<context name="string" attribute="string" lineEndContext="#pop#pop">
	<DetectChar char="&quot;" attribute="string" context="#pop!rvalue_operator"/>
</context>

<context name="array" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
	<DetectSpaces/>
	<DetectChar char="," attribute="coma"/>
	<DetectChar char="]" attribute="operator" context="#pop!rvalue_operator"/>
</context>

<context name="object" attribute="g" lineEndContext="#stay">
	<DetectSpaces/>
	<IncludeRules context="@comment"/>
	<DetectChar char="," attribute="coma"/>
	<DetectChar char="}" attribute="operator" context="#pop!rvalue_operator"/>
	<DetectChar char="&quot;" attribute="var" context="object_param_string"/>
	<DetectIdentifier attribute="var" context="object_param_colon"/>
</context>

<context name="object_param_string" attribute="var" lineEndContext="#pop">
	<DetectChar char="&quot;" attribute="var" context="#pop!object_param_colon"/>
</context>

<context name="object_param_colon" attribute="g" lineEndContext="#pop">
	<DetectSpaces/>
	<IncludeRules context="@comment"/>
	<DetectChar char=":" attribute="operator" context="#pop!rvalue"/>
</context>

<context name="float" attribute="float" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<!-- documentation says this is a valid string, but implementation gives compile error -->
	<!--<RegExpr String="[-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?\$" attribute="string" context="postfix_delimiter"/>-->
	<!--<RegExpr String="[-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?[%&amp;]" attribute="dec" context="postfix_delimiter"/>-->
	<RegExpr String="[-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?[!#]?" attribute="float" context="postfix_delimiter"/>
</context>

<context name="int" attribute="dec" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<!-- documentation says this is a valid string, but implementation gives compile error -->
	<!--<RegExpr String="[-+]?[0-9]*\$" attribute="string" context="postfix_delimiter"/>-->
	<RegExpr String="[-+]?[0-9]*[!#]" attribute="float" context="postfix_delimiter"/>
	<RegExpr String="[-+]?[0-9]*[%&amp;]?" attribute="dec" context="postfix_delimiter"/>
</context>

<context name="hex" attribute="invalid" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
	<RegExpr String="[0-9a-fA-F]+" insensitive="true" attribute="dec" context="#pop"/>
</context>

<context name="postfix_delimiter" attribute="g" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
	<RegExpr String="[\s\W]" context="#pop#pop!rvalue_operator" lookAhead="true"/>
</context>

<context name="rvalue_call" attribute="g" lineEndContext="#stay">
	<DetectIdentifier attribute="func" context="#pop!rvalue_call_open_brace"/>
</context>

<context name="rvalue_call_open_brace" attribute="g" lineEndContext="#stay">
	<IncludeRules context="@rvalue_call_open_brace"/>
</context>

<context name="@rvalue_call_open_brace" attribute="g" lineEndContext="#stay">
	<DetectChar char="(" attribute="scope" context="rvalue_call_args"/>
</context>

<context name="rvalue_call_args" attribute="g" lineEndContext="#stay" fallthrough="true" fallthroughContext="rvalue">
	<DetectSpaces/>
	<DetectChar char=")" attribute="scope" context="#pop#pop!rvalue_operator"/>
	<DetectChar char="," attribute="coma"/>
</context>

</contexts>




<itemDatas>
	<itemData name="g"            defStyleNum="dsNormal"/>
	<itemData name="import"       defStyleNum="dsImport"/>
	<itemData name="func"         defStyleNum="dsFunction"/>
	<itemData name="keyword"      defStyleNum="dsKeyword"/>
	<itemData name="control"      defStyleNum="dsControlFlow"/>
	<itemData name="assign"       defStyleNum="dsOperator"/>
	<itemData name="binary"       defStyleNum="dsOperator"/>
	<itemData name="unary"        defStyleNum="dsOperator"/>
	<itemData name="operator"     defStyleNum="dsOperator"/>
	<itemData name="scope"        defStyleNum="dsOperator"/>
	<itemData name="coma"         defStyleNum="dsOperator"/>
	<itemData name="type"         defStyleNum="dsDataType"/>
	<itemData name="var"          defStyleNum="dsVariable"/>
	<itemData name="comment"      defStyleNum="dsComment"/>
	<itemData name="print"        defStyleNum="dsBuiltIn"/>
	<itemData name="builtin_func" defStyleNum="dsBuiltIn"/>
	<itemData name="library_func" defStyleNum="dsBuiltIn"/>
	<itemData name="dec"          defStyleNum="dsDecVal"/>
	<itemData name="float"        defStyleNum="dsFloat"/>
	<itemData name="string"       defStyleNum="dsString"/>
	<itemData name="constant"     defStyleNum="dsConstant"/>
	<itemData name="macro"        defStyleNum="dsPreprocessor"/>
	<itemData name="label"        defStyleNum="dsSpecialChar"/>
	<itemData name="line_break"   defStyleNum="dsSpecialChar"/>
	<itemData name="m"            defStyleNum="dsExtension"/>
	<itemData name="top"          defStyleNum="dsExtension"/>
	<itemData name="invalid"      defStyleNum="dsError"/>
</itemDatas>

</highlighting>




<general>
	<comments>
		<comment name="singleLine" start="'"/>
	</comments>

	<keywords casesensitive="0" additionalDeliminator="'"/>
</general>

</language>
<!-- kate: replace-tabs off; -->