-
Notifications
You must be signed in to change notification settings - Fork 54
/
asm-z80-sj.xml
632 lines (598 loc) · 27.5 KB
/
asm-z80-sj.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
Z80 assembly Kate SYNTAX HIGHLIGHTING RULES for SJASMPLUS assembler
sjasmplus z00m's variant: https://github.com/z00m128/sjasmplus
Created: Peter Helcmanovsky <[email protected]>
Version: 0.9.7 20/08/2023
To install locally for your KDE5 desktop environment, copy the XML file into:
~/.local/share/org.kde.syntax-highlighting/syntax/
(and restart the editors)
Changelog:
// dd/mm/yyyy: version x.y (keep changelog in descending order)
// what was modified
20/08/2023: version 0.9.7
+ new device: amstradcpcplus
+ new directive: savecpr
29/03/2022: version 0.9.6
+ new operator: exist
+ new devices: amstradcpc464, amstradcpc6128
+ new directives: save3dos, savecdt, savecpcsna
+ new label prefix combination: "@." (should work only inside macros, but works globally)
+ new temporary label syntax with underscored suffix ("123_b")
21/01/2021: version 0.9.5
+ adding missing __DATE__/__TIME__ predefined defines
08/12/2020: version 0.9.4
+ new directives: ELSEIF, WHILE, ENDW, [list of known DEVICEs]
+ new operator: abs
+ highlighting operators as "Normal Text" inside Arguments
+ new label prefix char "!"
+ DEFL/EQU expect only expression afterward (up to colon), instructions not possible
18/08/2020: version 0.9.3
+ new directive TEXT added (STRUCT field)
+ adding support for EQU having comma delimited argument and closing curly braces
27/07/2020: version 0.9.2
+ new directives added (RELOCATE_..., BPLIST, SETBP)
+ new predefined defines, new "norel" operator
12/01/2020: version 0.9.1
+ fix after-label argument order of rules to work better with numeric constants
11/01/2020: version 0.9
+ new directives added (MMU, CSPECTMAP, SAVEDEV)
+ new logic to deal with "label defl/=/equ expression" start of line (not perfect)
+ dot-repeater is now detected also after colon (second+ time on line)
+ dot-repeater is detected also after label=... expression
+ inlined Lua scripts gets now regular Lua syntax highlight (included from system)
+ fix: ".directive" (starting with dot) is highlighted as directive
+ fix: Error context ends with colon (`ret z : nop` was displaying `: nop` as error)
28/05/2019: version 0.8.2
+ changes for new features after v1.13.0 (OPT, DEFARRAY+, ...)
14/05/2019: version 0.8.1
+ adding backtick as word deliminator to cover new double-backtick multi-arg symbol
+ "repeater" directive ".expression" support (not doing correctly nested parentheses)
13/04/2019: version 0.8
+ Numeric literals highlight rules extended with new C++ like rules
12/04/2019: version 0.7
Forked from my other asm-z80.xml syntax file, which is trying to support multiple
Z80 assemblers at the same time. But I'm spending more time with sjasmplus lately.
08/02/2019: version 0.6
+ fix: "out (c), 0" was not highlighted as unofficial instruction (space ahead 0)
19/01/2019: version 0.5
+ "error" context added to report unexpected arguments on remaining line (only *FEW*
cases are detected at the moment, it's nowhere near checking syntax properly)
+ Unofficial Z80 instructions highlighted as different category (dsExtension)
+ extra category for Z80N instructions (and Z80N control-flow instruction)
(highlights as ordinary instructions by default, user can manually adjust colors)
+ string highlight separated for apostrophe and quotes (other will be part of string)
+ "hex" directive - improved check marking extra digit/non-digit as error
+ couple of instructions detection improved (adding "error" context for arguments,etc)
This is probably one of last versions trying to stay "universal", as it works
considerably well for me (after about one month of using it actively), future
revisions will probably focus to narrow down syntax into more strict mode,
preferring my desired code style, and particular assembler ("pasmoNext" probably).
06/01/2019: version 0.2
+ instructions split into general group and control-flow group
+ comments now have TODO/FIXME/FIX ME highlighting support
30/12/2018: version 0.1
Initial version, released as part of ZXNextTests project (as "work in progress")
TODO missing things:
- argument highlighting (symbols, operators, ...) and validation of expected number
of arguments, etc... = of little importance to me personally, probably never
- arguments-end turning back to instruction/error context
This partially works, but doesn't try to fully validate expression, like
parentheses nesting and operators having expected arguments (unary/binary/...)
- needs rewrite from scratch to also parse label value expressions and do full analysis
- macro/equ/label symbols differentiation = I would *love* these, but they are not
possible with current Kate highlighting, as it would require extra input injected
by editor through some new API, to provide list of various (type) symbols.
- non-label identifiers (i.e. which are not valid labels (ignored by Label rules),
but they are valid identifiers for DEFINE or macro argument names
- Label identifiers rules into some xml macro (entities were in docs?).
- when more finished, try to propose to upstream: https://github.com/KDE/syntax-highlighting/tree/master/data/syntax
-->
<language name="Z80 (sjasmplus)" section="Assembler" version="17" kateversion="5.0" extensions="*.asm;*.a80;*.s" mimetype="" author="Peter Helcmanovsky ([email protected])" license="MIT">
<highlighting>
<list name="registers">
<!-- General purpose registers -->
<item>a</item>
<item>b</item>
<item>c</item>
<item>d</item>
<item>e</item>
<item>h</item>
<item>l</item>
<item>ixh</item>
<item>ixl</item>
<item>iyh</item>
<item>iyl</item>
<item>af</item>
<item>bc</item>
<item>de</item>
<item>hl</item>
<item>ix</item>
<item>iy</item>
<item>sp</item>
<!-- Shadow registers (only af' can be used directly in instruction) -->
<item>af'</item>
<item>bc'</item>
<item>de'</item>
<item>hl'</item>
<!-- Special registers -->
<item>i</item>
<item>r</item>
</list>
<list name="flow-instructions">
<item>call</item>
<item>djnz</item>
<item>halt</item>
<item>jp</item>
<item>jr</item>
<item>ret</item>
<item>reti</item>
<item>retn</item>
<item>rst</item>
</list>
<list name="instructions">
<item>adc</item>
<item>add</item>
<item>and</item>
<item>bit</item>
<item>ccf</item>
<item>cp</item>
<item>cpd</item>
<item>cpdr</item>
<item>cpi</item>
<item>cpir</item>
<item>cpl</item>
<item>daa</item>
<item>dec</item>
<item>di</item>
<item>ei</item>
<item>ex</item>
<item>exx</item>
<item>im</item>
<item>in</item>
<item>inc</item>
<item>ind</item>
<item>indr</item>
<item>ini</item>
<item>inir</item>
<item>ld</item>
<item>ldd</item>
<item>lddr</item>
<item>ldi</item>
<item>ldir</item>
<item>neg</item>
<item>nop</item>
<item>or</item>
<item>otdr</item>
<item>otir</item>
<item>out</item>
<item>outd</item>
<item>outi</item>
<item>pop</item>
<item>push</item>
<item>res</item>
<item>rl</item>
<item>rla</item>
<item>rlc</item>
<item>rlca</item>
<item>rld</item>
<item>rr</item>
<item>rra</item>
<item>rrc</item>
<item>rrca</item>
<item>rrd</item>
<item>sbc</item>
<item>scf</item>
<item>set</item>
<item>sla</item>
<item>sra</item>
<item>srl</item>
<item>sub</item>
<item>xor</item>
</list>
<list name="instructions-unofficial">
<!-- Unofficial instructions -->
<item>sli</item>
</list>
<list name="instructions-z80n">
<!-- ZX Spectrum Next (Z80N) extra instructions -->
<item>brlc</item>
<item>bsla</item>
<item>bsra</item>
<item>bsrf</item>
<item>bsrl</item>
<item>lddrx</item>
<item>lddx</item>
<item>ldirx</item>
<item>ldix</item>
<item>ldpirx</item>
<item>ldws</item>
<item>mirror</item>
<item>mul</item>
<item>nextreg</item>
<item>outinb</item>
<item>pixelad</item>
<item>pixeldn</item>
<item>setae</item>
<item>swapnib</item>
<item>test</item>
</list>
<list name="data">
<!-- Initialized data -->
<item>abyte</item>
<item>abytec</item>
<item>abytez</item>
<item>block</item>
<item>byte</item>
<item>d24</item>
<item>db</item>
<item>dc</item>
<item>dd</item>
<item>defb</item>
<item>defd</item>
<item>defg</item>
<item>defh</item>
<item>defm</item>
<item>defs</item>
<item>defw</item>
<item>dg</item>
<item>dh</item>
<item>dm</item>
<item>ds</item>
<item>dw</item>
<item>dword</item>
<item>dz</item>
<item>hex</item>
<item>text</item>
<item>word</item>
</list>
<list name="directives">
<item>align</item>
<item>assert</item>
<item>binary</item>
<item>bplist</item>
<item>cspectmap</item>
<item>defarray</item>
<item>defdevice</item>
<item>define</item>
<item>dephase</item>
<item>device</item>
<item>disp</item>
<item>display</item>
<item>dup</item>
<item>edup</item>
<item>else</item>
<item>elseif</item>
<item>emptytap</item>
<item>emptytrd</item>
<item>encoding</item>
<item>end</item>
<item>endif</item>
<item>endm</item>
<item>endmap</item>
<item>endmod</item>
<item>endmodule</item>
<item>endr</item>
<item>ends</item>
<item>endt</item>
<item>endw</item>
<item>ent</item>
<item>export</item>
<item>field</item>
<item>fpos</item>
<item>if</item>
<item>ifdef</item>
<item>ifn</item>
<item>ifndef</item>
<item>ifnused</item>
<item>ifused</item>
<item>incbin</item>
<item>inchob</item>
<item>include</item>
<item>includelua</item>
<item>inctrd</item>
<item>insert</item>
<item>labelslist</item>
<item>macro</item>
<item>map</item>
<item>memorymap</item>
<item>mmu</item>
<item>module</item>
<item>opt</item>
<item>org</item>
<item>outend</item>
<item>output</item>
<item>page</item>
<item>phase</item>
<item>relocate_end</item>
<item>relocate_start</item>
<item>relocate_table</item>
<item>rept</item>
<item>save3dos</item>
<item>savebin</item>
<item>savecdt</item>
<item>savecpcsna</item>
<item>savecpr</item>
<item>savedev</item>
<item>savehob</item>
<item>savenex</item>
<item>savesna</item>
<item>savetap</item>
<item>savetrd</item>
<item>setbp</item>
<item>setbreakpoint</item>
<item>shellexec</item>
<item>size</item>
<item>slot</item>
<item>struct</item>
<item>tapend</item>
<item>tapout</item>
<item>textarea</item>
<item>undefine</item>
<item>unphase</item>
<item>while</item>
</list>
<list name="operators"> <!-- TODO implement all of this -->
<!-- Predefined values by assembler (not really an operator) -->
<item>__SJASMPLUS__</item>
<item>__VERSION__</item>
<item>__PASS__</item>
<item>__ERRORS__</item>
<item>__WARNINGS__</item>
<item>__INCLUDE_LEVEL__</item>
<item>__BASE_FILE__</item>
<item>__FILE__</item>
<item>__LINE__</item>
<item>__COUNTER__</item>
<item>__DATE__</item>
<item>__TIME__</item>
<!-- Operators -->
<item>abs</item>
<item>and</item>
<item>exist</item>
<item>high</item>
<item>low</item>
<item>mod</item>
<item>norel</item>
<item>not</item>
<item>or</item>
<item>shl</item>
<item>shr</item>
<item>xor</item>
<!-- other operators/symbols:
$ $$ ! ~ + - * / % << >> >>> <? >? < > <= >= = == != & ^ | && || [ ] ( ) { }
-->
<!-- known devices names -->
<item>AMSTRADCPC464</item>
<item>AMSTRADCPC6128</item>
<item>AMSTRADCPCPLUS</item>
<item>NONE</item>
<item>NOSLOT64K</item>
<item>ZXSPECTRUM48</item>
<item>ZXSPECTRUM128</item>
<item>ZXSPECTRUM256</item>
<item>ZXSPECTRUM512</item>
<item>ZXSPECTRUM1024</item>
<item>ZXSPECTRUM2048</item>
<item>ZXSPECTRUM4096</item>
<item>ZXSPECTRUM8192</item>
<item>ZXSPECTRUMNEXT</item>
</list>
<contexts>
<context name="LabelLine" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="#stay"
fallthrough="true" fallthroughContext="Error">
<!-- Labels can start only at the beginning of the line, if not at beginning, the "Normal" context follows -->
<DetectSpaces attribute="Normal Text" context="#pop!dotRepeat"/>
<DetectChar attribute="Comment" context="#pop!Normal" char=";" lookAhead="true"/>
<Detect2Chars attribute="Comment" context="#pop!Normal" char="/" char1="/" lookAhead="true"/>
<Detect2Chars attribute="Comment" context="#pop!Normal" char="/" char1="*" lookAhead="true"/>
<DetectChar attribute="Normal Text" context="#pop!Normal" char="}"/>
<RegExpr attribute="Label" context="#pop!afterLabel" firstNonSpace="true"
String="^(@\.|\.|@|\!|\!@|)[A-Za-z_][A-Za-z0-9_.?!#@]*(\+[0-9]|):?"/>
<RegExpr attribute="Label" context="#pop!afterLabel" String="^[0-9]+:?(\s+|$)"/>
</context>
<!-- Detect EQU/DEFL/= expressions, the argument now must end with colon (no instruction possible after expression since sjasmplus v1.18.0 -->
<context name="afterLabel" attribute="Normal Text" lineEndContext="LabelLine" fallthrough="true" fallthroughContext="dotRepeat">
<DetectSpaces attribute="Normal Text" context="#stay"/>
<DetectChar attribute="Directives" context="#pop!Arguments" char="=" />
<WordDetect attribute="Directives" context="#pop!Arguments" String="DEFL"/>
<WordDetect attribute="Directives" context="#pop!Arguments" String="defl"/>
<WordDetect attribute="Directives" context="#pop!Arguments" String="EQU"/>
<WordDetect attribute="Directives" context="#pop!Arguments" String="equ"/>
</context>
<context name="dotRepeat" attribute="Directives" lineEndContext="LabelLine" fallthrough="true" fallthroughContext="Normal">
<DetectSpaces attribute="Normal Text" context="#stay"/>
<RegExpr attribute="Directives" context="#pop!Normal" String="\.(\d+|\(.*?\))\s"/>
</context>
<context name="Normal" attribute="Normal Text" lineEndContext="LabelLine"
lineEmptyContext="LabelLine" fallthrough="true" fallthroughContext="Arguments">
<!-- "normal" line, but without the label at beginning -->
<DetectSpaces attribute="Normal Text" context="#stay"/>
<IncludeRules context="BeginComment" />
<WordDetect attribute="Data" context="Hexastring" insensitive="true" String="hex"/>
<WordDetect attribute="Data" context="Hexastring" insensitive="true" String="dh"/>
<WordDetect attribute="Data" context="Hexastring" insensitive="true" String="defh"/>
<WordDetect attribute="Data" context="Bitstring" insensitive="true" String="dg"/>
<WordDetect attribute="Data" context="Bitstring" insensitive="true" String="defg"/>
<RegExpr attribute="Z80N Flow ins." context="Error" insensitive="true"
String="jp\s+\(c\)\s*"/>
<RegExpr attribute="Control Flow ins." context="Arguments" insensitive="true"
String="(call|jp)\s+(nz|z|nc|c|po|pe|p|m|ns|s)\s*,"/>
<RegExpr attribute="Control Flow ins." context="Arguments" insensitive="true"
String="jr\s+(nz|z|nc|c)\s*,"/>
<RegExpr attribute="Control Flow ins." context="Error" insensitive="true"
String="ret\s+(nz|z|nc|c|po|pe|p|m|ns|s)\b\s*"/>
<RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
String="(in\s+(f,\s*|)\(c\)|out\s+\(c\),\s*0\b)\s*"/>
<RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
String="(rlc|rrc|rl|rr|sla|sll|sra|sli|sl1|srl)\s+\(\s*(ix|iy)\s*(\+|\-)[^;]*\),\s*[a-ehl]\b\s*"/>
<RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
String="(res|set)\s+[0-7],\s*\(\s*(ix|iy)\s*(\+|\-)[^;]*\),\s*[a-ehl]\b\s*"/>
<RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
String="(inc|dec|sub|and|or|xor|cp)\s+i[xy][lh]\b\s*"/>
<RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
String="(add|adc|sub|and|or|xor|cp)\s+a,\s*i[xy][lh]\b\s*"/>
<RegExpr attribute="Unofficial ins." context="Arguments" insensitive="true"
String="ld\s+i[xy][lh],\s*"/>
<RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
String="ld\s+[a-e],\s*i[xy][lh]\b\s*"/>
<keyword attribute="Control Flow ins." context="Arguments" String="flow-instructions"/>
<keyword attribute="Unofficial ins." context="Arguments" String="instructions-unofficial"/>
<keyword attribute="Z80N Instructions" context="Arguments" String="instructions-z80n"/>
<keyword attribute="Instructions" context="Arguments" String="instructions"/>
<keyword attribute="Data" context="Arguments" String="data"/>
<!-- inlined LUA script block detection -->
<RegExpr attribute="Directives" context="LuaInlinedScript_Enter"
String="\.?(lua|LUA)\b(\s+(PASS[123]|pass[123]|ALLPASS|allpass)|)\s*"/>
<!-- directives detection is defined twice, to detect the directives starting with dot -->
<DetectChar attribute="Directives" char=".">
<WordDetect context="sourceEnd" String="end"/>
<WordDetect context="sourceEnd" String="END"/>
<WordDetect context="Arguments" String="defarray+"/>
<WordDetect context="Arguments" String="DEFARRAY+"/>
<keyword context="Arguments" String="directives"/>
</DetectChar>
<!-- end is defined twice (not "insensitive"), b/c "End" is label!, only all-up/all-low is -->
<WordDetect attribute="Directives" context="sourceEnd" String="end"/>
<WordDetect attribute="Directives" context="sourceEnd" String="END"/>
<!-- defarray+ can't be found by keyword because of "+" being delimiter, when weak delimiter, then "(ix+1)" is not register :/ -->
<WordDetect attribute="Directives" context="Arguments" String="defarray+"/>
<WordDetect attribute="Directives" context="Arguments" String="DEFARRAY+"/>
<keyword attribute="Directives" context="Arguments" String="directives"/>
</context>
<!-- After "END" directive show everything as comment -->
<context name="sourceEnd" attribute="Comment" lineEndContext="#stay" />
<context name="Error" attribute="Error" lineEndContext="#pop">
<DetectChar attribute="Normal Text" context="#pop#pop!dotRepeat" char=":"/>
<DetectChar attribute="Comment" context="Comment" char=";"/>
<Detect2Chars attribute="Comment" context="Comment" char="/" char1="/"/>
</context>
<!-- "Hexastring" highlight for DEFH/DH/HEX directive -->
<context name="Hexastring" attribute="Normal Text" lineEndContext="#pop"
fallthrough="true" fallthroughContext="#pop!Error">
<DetectChar attribute="Comment" context="HexastringQuoted" char="""/>
<DetectChar attribute="Comment" context="HexastringQuoted" char="'"/>
<DetectChar attribute="Comment" context="#stay" char=","/>
<DetectSpaces attribute="Normal Text" context="#stay"/>
<IncludeRules context="BeginComment" />
<RegExpr attribute="BaseN" context="#stay" String="([0-9A-Fa-f]{2})+"/>
</context>
<context name="HexastringQuoted" attribute="Normal Text" lineEndContext="#pop"
fallthrough="true" fallthroughContext="#pop#pop!Error">
<DetectChar attribute="Comment" context="#pop" char="""/>
<DetectChar attribute="Comment" context="#pop" char="'"/>
<DetectSpaces attribute="Normal Text" context="#stay"/>
<RegExpr attribute="BaseN" context="#stay" String="([0-9A-Fa-f]{2})+"/>
</context>
<!-- "Bitstring" highlight for DEFG/DG directive -->
<context name="Bitstring" attribute="Data" lineEndContext="#pop"
fallthrough="true" fallthroughContext="#pop!Error">
<DetectSpaces attribute="Comment" context="#stay"/>
<AnyChar String=""'" attribute="Comment" context="#stay"/>
<RegExpr attribute="Data" context="BitstringBits" lookAhead="true" String="(([^\s"';][ \t]*){7}[^\s"';])(.*)$"/>
</context>
<context name="BitstringBits" attribute="Data" lineEndContext="#pop#pop" dynamic="true">
<RegExpr attribute="Data" context="#pop" String="%3$" lookAhead="true" dynamic="true" />
<RegExpr String="[-._ \t]" attribute="Data" context="#stay" />
<RegExpr String="." attribute="Number" context="#stay" />
</context>
<!-- "arguments" = generally anything what is not detected as instruction/directive or is comming after instruction -->
<context name="Arguments" attribute="Normal Text" lineEndContext="#pop">
<IncludeRules context="BeginComment" />
<DetectChar attribute="Normal Text" context="#pop#pop!dotRepeat" char=":"/>
<DetectChar attribute="String" context="StringApostrophe" char="'"/>
<DetectChar attribute="String" context="String" char="""/>
<keyword attribute="Registers" context="#stay" String="registers"/>
<keyword attribute="Normal Text" context="#stay" String="operators"/>
<RegExpr attribute="Label" context="#stay" String="(\.|@|)[A-Za-z_][A-Za-z0-9_.?!#@]*"/>
<!-- temporary labels may be mistaken for binary number ("1b"), for 1-3 digits it's temporary label -->
<RegExpr attribute="Label" context="#stay" String="\d{1,3}[bBfF]\b"/>
<RegExpr attribute="Label" context="#stay" String="\d+_[bBfF]\b"/> <!-- v1.19.0 temporary label syntax -->
<!-- TODO but some DEFINE/macro-arg identifiers can avoid labels rules, like ".._" is valid! -->
<!-- hexadecimal numbers -->
<RegExpr attribute="BaseN" context="#stay" insensitive="true" String="((\$|0x|#)[a-f0-9]('?[a-f0-9]+)*|[0-9]('?[a-f0-9]+)*h)\b"/>
<!-- octal numbers -->
<RegExpr attribute="BaseN" context="#stay" insensitive="true" String="(0q[0-7]('?[0-7]+)*|[0-7]('?[0-7]+)*(q|o))\b"/>
<!-- binary numbers -->
<RegExpr attribute="BaseN" context="#stay" insensitive="true" String="((%|0b)[01]('?[01]+)*|[01]('?[01]+)*b)\b"/>
<!-- decimal numbers -->
<RegExpr attribute="Number" context="#stay" insensitive="true" String="\d('?\d+)*d?\b"/>
<Detect2Chars attribute="Number" context="#stay" char="$" char1="$"/>
<DetectChar attribute="Number" context="#stay" char="$"/>
<AnyChar String="!~+-*/%<>?=&^|[]()," attribute="Normal Text" context="#stay"/>
</context>
<!-- Comments, rules and contexts -->
<context name="BeginComment" attribute="Comment" lineEndContext="#pop">
<!-- this context just hold rules for starting comment, shouldn't be switched to -->
<DetectChar attribute="Comment" context="Comment" char=";"/>
<Detect2Chars attribute="Comment" context="Comment" char="/" char1="/"/>
<Detect2Chars attribute="Comment" context="CommentB" char="/" char1="*" beginRegion="Comment"/>
<Detect2Chars attribute="Error" context="Error" char="*" char1="/"/>
</context>
<context name="Comment" attribute="Comment" lineEndContext="#pop">
<DetectSpaces />
<RegExpr attribute="Alert" context="#stay" String="\b(TODO|FIX\s?ME|DEBUG)\b"/>
</context>
<context name="CommentB" attribute="Comment" lineEndContext="#stay"> <!-- block multiline comment /* */ -->
<IncludeRules context="Comment" />
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment" />
<!-- in sjasmplus the block comments actually can be nested! -->
<Detect2Chars attribute="Comment" context="CommentB" char="/" char1="*" beginRegion="Comment"/>
</context>
<!-- Strings -->
<context name="StringEscape" attribute="Char" fallthrough="true" fallthroughContext="#pop#pop!Error">
<AnyChar String="\?'"0AaBbDdEeFfNnRrTtVv" attribute="Char" context="#pop"/>
</context>
<context name="String" attribute="String" lineEndContext="#pop">
<DetectChar attribute="Char" context="StringEscape" char="\"/>
<DetectChar attribute="String" context="#pop" char="""/>
</context>
<context name="StringApostrophe" attribute="String" lineEndContext="#pop">
<Detect2Chars attribute="Char" context="#stay" char="'" char1="'"/>
<DetectChar attribute="String" context="#pop" char="'"/>
</context>
<context name="LuaInlinedScript_Enter" attribute="Error" lineEndContext="#pop!LuaInlinedScript">
<DetectChar attribute="Comment" context="Comment" char=";"/>
<Detect2Chars attribute="Comment" context="Comment" char="/" char1="/"/>
</context>
<context name="LuaInlinedScript" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="Directives" char=".">
<WordDetect context="#pop!Error" String="endlua"/>
<WordDetect context="#pop!Error" String="ENDLUA"/>
</DetectChar>
<WordDetect attribute="Directives" context="#pop!Error" String="endlua"/>
<WordDetect attribute="Directives" context="#pop!Error" String="ENDLUA"/>
<IncludeRules context="Normal##Lua"/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal"/>
<itemData name="Error" defStyleNum="dsError"/>
<itemData name="Registers" defStyleNum="dsVariable"/>
<itemData name="Instructions" defStyleNum="dsKeyword"/>
<itemData name="Unofficial ins." defStyleNum="dsExtension"/>
<itemData name="Z80N Instructions" defStyleNum="dsKeyword"/>
<itemData name="Z80N Flow ins." defStyleNum="dsControlFlow"/>
<itemData name="Control Flow ins." defStyleNum="dsControlFlow"/>
<itemData name="Directives" defStyleNum="dsPreprocessor"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="Alert" defStyleNum="dsAlert"/>
<itemData name="Label" defStyleNum="dsFunction"/>
<itemData name="Data" defStyleNum="dsDataType"/>
<itemData name="BaseN" defStyleNum="dsBaseN"/>
<itemData name="Float" defStyleNum="dsFloat"/>
<itemData name="Number" defStyleNum="dsDecVal"/>
<itemData name="Char" defStyleNum="dsChar"/>
<itemData name="String" defStyleNum="dsString"/>
</itemDatas>
</highlighting>
<general>
<keywords casesensitive="0" additionalDeliminator="`"/>
<comments>
<comment name="singleLine" start=";" />
<comment name="multiLine" start="/*" end="*/" />
</comments>
</general>
</language>
<!-- kate: space-indent on; indent-width 2; replace-tabs on; -->