?login_element?

Subversion Repositories NedoOS

Rev

Rev 539 | Blame | Compare with Previous | Last modification | View Log | Download

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE language SYSTEM "language.dtd">
  3. <!--
  4.   Z80 assembly Kate SYNTAX HIGHLIGHTING RULES for SJASMPLUS assembler
  5.   sjasmplus z00m's variant: https://github.com/z00m128/sjasmplus
  6.  
  7.  Created: Peter Helcmanovsky <ped@7gods.org>
  8.  Version: 0.9.6 29/03/2022
  9.  
  10.  To install locally for your KDE5 desktop environment, copy the XML file into:
  11.    ~/.local/share/org.kde.syntax-highlighting/syntax/
  12.  (and restart the editors)
  13.  
  14. Changelog:
  15.  // dd/mm/yyyy: version x.y (keep changelog in descending order)
  16.  //   what was modified
  17.  
  18.  29/03/2022: version 0.9.6
  19.    + new operator: exist
  20.    + new devices: amstradcpc464, amstradcpc6128
  21.    + new directives: save3dos, savecdt, savecpcsna
  22.    + new label prefix combination: "@." (should work only inside macros, but works globally)
  23.    + new temporary label syntax with underscored suffix ("123_b")
  24.  
  25.  21/01/2021: version 0.9.5
  26.    + adding missing __DATE__/__TIME__ predefined defines
  27.  
  28.  08/12/2020: version 0.9.4
  29.    + new directives: ELSEIF, WHILE, ENDW, [list of known DEVICEs]
  30.    + new operator: abs
  31.    + highlighting operators as "Normal Text" inside Arguments
  32.    + new label prefix char "!"
  33.    + DEFL/EQU expect only expression afterward (up to colon), instructions not possible
  34.  
  35.  18/08/2020: version 0.9.3
  36.    + new directive TEXT added (STRUCT field)
  37.    + adding support for EQU having comma delimited argument and closing curly braces
  38.  
  39.  27/07/2020: version 0.9.2
  40.    + new directives added (RELOCATE_..., BPLIST, SETBP)
  41.    + new predefined defines, new "norel" operator
  42.  
  43.  12/01/2020: version 0.9.1
  44.    + fix after-label argument order of rules to work better with numeric constants
  45.  
  46.  11/01/2020: version 0.9
  47.    + new directives added (MMU, CSPECTMAP, SAVEDEV)
  48.    + new logic to deal with "label defl/=/equ expression" start of line (not perfect)
  49.    + dot-repeater is now detected also after colon (second+ time on line)
  50.    + dot-repeater is detected also after label=... expression
  51.    + inlined Lua scripts gets now regular Lua syntax highlight (included from system)
  52.    + fix: ".directive" (starting with dot) is highlighted as directive
  53.    + fix: Error context ends with colon (`ret z : nop` was displaying `: nop` as error)
  54.  
  55.  28/05/2019: version 0.8.2
  56.    + changes for new features after v1.13.0 (OPT, DEFARRAY+, ...)
  57.  
  58.  14/05/2019: version 0.8.1
  59.    + adding backtick as word deliminator to cover new double-backtick multi-arg symbol
  60.    + "repeater" directive ".expression" support (not doing correctly nested parentheses)
  61.  
  62.  13/04/2019: version 0.8
  63.    + Numeric literals highlight rules extended with new C++ like rules
  64.  
  65.  12/04/2019: version 0.7
  66.    Forked from my other asm-z80.xml syntax file, which is trying to support multiple
  67.    Z80 assemblers at the same time. But I'm spending more time with sjasmplus lately.
  68.  
  69.   08/02/2019: version 0.6
  70.     + fix: "out (c), 0" was not highlighted as unofficial instruction (space ahead 0)
  71.  
  72.   19/01/2019: version 0.5
  73.     + "error" context added to report unexpected arguments on remaining line (only *FEW*
  74.         cases are detected at the moment, it's nowhere near checking syntax properly)
  75.    + Unofficial Z80 instructions highlighted as different category (dsExtension)
  76.    + extra category for Z80N instructions (and Z80N control-flow instruction)
  77.        (highlights as ordinary instructions by default, user can manually adjust colors)
  78.    + string highlight separated for apostrophe and quotes (other will be part of string)
  79.    + "hex" directive - improved check marking extra digit/non-digit as error
  80.    + couple of instructions detection improved (adding "error" context for arguments,etc)
  81.  
  82.    This is probably one of last versions trying to stay "universal", as it works
  83.    considerably well for me (after about one month of using it actively), future
  84.    revisions will probably focus to narrow down syntax into more strict mode,
  85.    preferring my desired code style, and particular assembler ("pasmoNext" probably).
  86.  
  87.  06/01/2019: version 0.2
  88.    + instructions split into general group and control-flow group
  89.    + comments now have TODO/FIXME/FIX ME highlighting support
  90.  
  91.  30/12/2018: version 0.1
  92.    Initial version, released as part of ZXNextTests project (as "work in progress")
  93.  
  94. TODO missing things:
  95.    - argument highlighting (symbols, operators, ...) and validation of expected number
  96.        of arguments, etc... = of little importance to me personally, probably never
  97.    - arguments-end turning back to instruction/error context
  98.        This partially works, but doesn't try to fully validate expression, like
  99.         parentheses nesting and operators having expected arguments (unary/binary/...)
  100.         - needs rewrite from scratch to also parse label value expressions and do full analysis
  101.     - macro/equ/label symbols differentiation = I would *love* these, but they are not
  102.         possible with current Kate highlighting, as it would require extra input injected
  103.         by editor through some new API, to provide list of various (type) symbols.
  104.     - non-label identifiers (i.e. which are not valid labels (ignored by Label rules),
  105.       but they are valid identifiers for DEFINE or macro argument names
  106.     - Label identifiers rules into some xml macro (entities were in docs?).
  107.     - when more finished, try to propose to upstream: https://github.com/KDE/syntax-highlighting/tree/master/data/syntax
  108.  
  109. -->
  110. <language name="Z80 (sjasmplus)" section="Assembler" version="16" kateversion="5.0" extensions="*.asm;*.a80;*.s" mimetype="" author="Peter Helcmanovsky (ped@7gods.org)" license="MIT">
  111.   <highlighting>
  112.     <list name="registers">
  113.       <!-- General purpose registers -->
  114.       <item>a</item>
  115.       <item>b</item>
  116.       <item>c</item>
  117.       <item>d</item>
  118.       <item>e</item>
  119.       <item>h</item>
  120.       <item>l</item>
  121.       <item>ixh</item>
  122.       <item>ixl</item>
  123.       <item>iyh</item>
  124.       <item>iyl</item>
  125.       <item>af</item>
  126.       <item>bc</item>
  127.       <item>de</item>
  128.       <item>hl</item>
  129.       <item>ix</item>
  130.       <item>iy</item>
  131.       <item>sp</item>
  132.       <!-- Shadow registers (only af' can be used directly in instruction) -->
  133.      <item>af'</item>
  134.       <item>bc'</item>
  135.      <item>de'</item>
  136.       <item>hl'</item>
  137.      <!-- Special registers -->
  138.      <item>i</item>
  139.      <item>r</item>
  140.    </list>
  141.    <list name="flow-instructions">
  142.      <item>call</item>
  143.      <item>djnz</item>
  144.      <item>halt</item>
  145.      <item>jp</item>
  146.      <item>jr</item>
  147.      <item>ret</item>
  148.      <item>reti</item>
  149.      <item>retn</item>
  150.      <item>rst</item>
  151.    </list>
  152.    <list name="instructions">
  153.      <item>adc</item>
  154.      <item>add</item>
  155.      <item>and</item>
  156.      <item>bit</item>
  157.      <item>ccf</item>
  158.      <item>cp</item>
  159.      <item>cpd</item>
  160.      <item>cpdr</item>
  161.      <item>cpi</item>
  162.      <item>cpir</item>
  163.      <item>cpl</item>
  164.      <item>daa</item>
  165.      <item>dec</item>
  166.      <item>di</item>
  167.      <item>ei</item>
  168.      <item>ex</item>
  169.      <item>exx</item>
  170.      <item>im</item>
  171.      <item>in</item>
  172.      <item>inc</item>
  173.      <item>ind</item>
  174.      <item>indr</item>
  175.      <item>ini</item>
  176.      <item>inir</item>
  177.      <item>ld</item>
  178.      <item>ldd</item>
  179.      <item>lddr</item>
  180.      <item>ldi</item>
  181.      <item>ldir</item>
  182.      <item>neg</item>
  183.      <item>nop</item>
  184.      <item>or</item>
  185.      <item>otdr</item>
  186.      <item>otir</item>
  187.      <item>out</item>
  188.      <item>outd</item>
  189.      <item>outi</item>
  190.      <item>pop</item>
  191.      <item>push</item>
  192.      <item>res</item>
  193.      <item>rl</item>
  194.      <item>rla</item>
  195.      <item>rlc</item>
  196.      <item>rlca</item>
  197.      <item>rld</item>
  198.      <item>rr</item>
  199.      <item>rra</item>
  200.      <item>rrc</item>
  201.      <item>rrca</item>
  202.      <item>rrd</item>
  203.      <item>sbc</item>
  204.      <item>scf</item>
  205.      <item>set</item>
  206.      <item>sla</item>
  207.      <item>sra</item>
  208.      <item>srl</item>
  209.      <item>sub</item>
  210.      <item>xor</item>
  211.    </list>
  212.    <list name="instructions-unofficial">
  213.      <!-- Unofficial instructions -->
  214.      <item>sli</item>
  215.    </list>
  216.    <list name="instructions-z80n">
  217.      <!-- ZX Spectrum Next (Z80N) extra instructions -->
  218.      <item>brlc</item>
  219.      <item>bsla</item>
  220.      <item>bsra</item>
  221.      <item>bsrf</item>
  222.      <item>bsrl</item>
  223.      <item>lddrx</item>
  224.      <item>lddx</item>
  225.      <item>ldirx</item>
  226.      <item>ldix</item>
  227.      <item>ldpirx</item>
  228.      <item>ldws</item>
  229.      <item>mirror</item>
  230.      <item>mul</item>
  231.      <item>nextreg</item>
  232.      <item>outinb</item>
  233.      <item>pixelad</item>
  234.      <item>pixeldn</item>
  235.      <item>setae</item>
  236.      <item>swapnib</item>
  237.      <item>test</item>
  238.    </list>
  239.    <list name="data">
  240.      <!-- Initialized data -->
  241.      <item>abyte</item>
  242.      <item>abytec</item>
  243.      <item>abytez</item>
  244.      <item>block</item>
  245.      <item>byte</item>
  246.      <item>d24</item>
  247.      <item>db</item>
  248.      <item>dc</item>
  249.      <item>dd</item>
  250.      <item>defb</item>
  251.      <item>defd</item>
  252.      <item>defg</item>
  253.      <item>defh</item>
  254.      <item>defm</item>
  255.      <item>defs</item>
  256.      <item>defw</item>
  257.      <item>dg</item>
  258.      <item>dh</item>
  259.      <item>dm</item>
  260.      <item>ds</item>
  261.      <item>dw</item>
  262.      <item>dword</item>
  263.      <item>dz</item>
  264.      <item>hex</item>
  265.      <item>text</item>
  266.      <item>word</item>
  267.      </list>
  268.    <list name="directives">
  269.      <item>align</item>
  270.      <item>assert</item>
  271.      <item>binary</item>
  272.      <item>bplist</item>
  273.      <item>cspectmap</item>
  274.      <item>defarray</item>
  275.      <item>defdevice</item>
  276.      <item>define</item>
  277.      <item>dephase</item>
  278.      <item>device</item>
  279.      <item>disp</item>
  280.      <item>display</item>
  281.      <item>dup</item>
  282.      <item>edup</item>
  283.      <item>else</item>
  284.      <item>elseif</item>
  285.      <item>emptytap</item>
  286.      <item>emptytrd</item>
  287.      <item>encoding</item>
  288.      <item>end</item>
  289.      <item>endif</item>
  290.      <item>endm</item>
  291.      <item>endmap</item>
  292.      <item>endmod</item>
  293.      <item>endmodule</item>
  294.      <item>endr</item>
  295.      <item>ends</item>
  296.      <item>endt</item>
  297.      <item>endw</item>
  298.      <item>ent</item>
  299.      <item>export</item>
  300.      <item>field</item>
  301.      <item>fpos</item>
  302.      <item>if</item>
  303.      <item>ifdef</item>
  304.      <item>ifn</item>
  305.      <item>ifndef</item>
  306.      <item>ifnused</item>
  307.      <item>ifused</item>
  308.      <item>incbin</item>
  309.      <item>inchob</item>
  310.      <item>include</item>
  311.      <item>includelua</item>
  312.      <item>inctrd</item>
  313.      <item>insert</item>
  314.      <item>labelslist</item>
  315.      <item>macro</item>
  316.      <item>map</item>
  317.      <item>memorymap</item>
  318.      <item>mmu</item>
  319.      <item>module</item>
  320.      <item>opt</item>
  321.      <item>org</item>
  322.      <item>outend</item>
  323.      <item>output</item>
  324.      <item>page</item>
  325.      <item>phase</item>
  326.      <item>relocate_end</item>
  327.      <item>relocate_start</item>
  328.      <item>relocate_table</item>
  329.      <item>rept</item>
  330.      <item>save3dos</item>
  331.      <item>savebin</item>
  332.      <item>savecdt</item>
  333.      <item>savecpcsna</item>
  334.      <item>savedev</item>
  335.      <item>savehob</item>
  336.      <item>savenex</item>
  337.      <item>savesna</item>
  338.      <item>savetap</item>
  339.      <item>savetrd</item>
  340.      <item>setbp</item>
  341.      <item>setbreakpoint</item>
  342.      <item>shellexec</item>
  343.      <item>size</item>
  344.      <item>slot</item>
  345.      <item>struct</item>
  346.      <item>tapend</item>
  347.      <item>tapout</item>
  348.      <item>textarea</item>
  349.      <item>undefine</item>
  350.      <item>unphase</item>
  351.      <item>while</item>
  352.    </list>
  353.    <list name="operators"> <!-- TODO implement all of this -->
  354.      <!-- Predefined values by assembler (not really an operator) -->
  355.      <item>__SJASMPLUS__</item>
  356.      <item>__VERSION__</item>
  357.      <item>__PASS__</item>
  358.      <item>__ERRORS__</item>
  359.      <item>__WARNINGS__</item>
  360.      <item>__INCLUDE_LEVEL__</item>
  361.      <item>__BASE_FILE__</item>
  362.      <item>__FILE__</item>
  363.      <item>__LINE__</item>
  364.      <item>__COUNTER__</item>
  365.      <item>__DATE__</item>
  366.      <item>__TIME__</item>
  367.      <!-- Operators -->
  368.      <item>abs</item>
  369.      <item>and</item>
  370.      <item>exist</item>
  371.      <item>high</item>
  372.      <item>low</item>
  373.      <item>mod</item>
  374.      <item>norel</item>
  375.      <item>not</item>
  376.      <item>or</item>
  377.      <item>shl</item>
  378.      <item>shr</item>
  379.      <item>xor</item>
  380.      <!-- other operators/symbols:
  381.      $ $$ ! ~ + - * / % << >> >>> <? >? < > <= >= = == != & ^ | && || [ ] ( ) { }
  382.      -->
  383.      <!-- known devices names -->
  384.      <item>AMSTRADCPC464</item>
  385.      <item>AMSTRADCPC6128</item>
  386.      <item>NONE</item>
  387.      <item>NOSLOT64K</item>
  388.      <item>ZXSPECTRUM48</item>
  389.      <item>ZXSPECTRUM128</item>
  390.      <item>ZXSPECTRUM256</item>
  391.      <item>ZXSPECTRUM512</item>
  392.      <item>ZXSPECTRUM1024</item>
  393.      <item>ZXSPECTRUM2048</item>
  394.      <item>ZXSPECTRUM4096</item>
  395.      <item>ZXSPECTRUM8192</item>
  396.      <item>ZXSPECTRUMNEXT</item>
  397.      </list>
  398.    <contexts>
  399.      <context name="LabelLine" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="#stay"
  400.               fallthrough="true" fallthroughContext="Error">
  401.        <!-- Labels can start only at the beginning of the line, if not at beginning, the "Normal" context follows -->
  402.        <DetectSpaces attribute="Normal Text" context="#pop!dotRepeat"/>
  403.        <DetectChar attribute="Comment" context="#pop!Normal" char=";" lookAhead="true"/>
  404.        <Detect2Chars attribute="Comment" context="#pop!Normal" char="/" char1="/" lookAhead="true"/>
  405.        <Detect2Chars attribute="Comment" context="#pop!Normal" char="/" char1="*" lookAhead="true"/>
  406.        <DetectChar attribute="Normal Text" context="#pop!Normal" char="}"/>
  407.        <RegExpr attribute="Label" context="#pop!afterLabel" firstNonSpace="true"
  408.                 String="^(@\.|\.|@|\!|\!@|)[A-Za-z_][A-Za-z0-9_.?!#@]*(\+[0-9]|):?"/>
  409.        <RegExpr attribute="Label" context="#pop!afterLabel" String="^[0-9]+:?(\s+|$)"/>
  410.      </context>
  411.  
  412.      <!-- Detect EQU/DEFL/= expressions, the argument now must end with colon (no instruction possible after expression since sjasmplus v1.18.0 -->
  413.      <context name="afterLabel" attribute="Normal Text" lineEndContext="LabelLine" fallthrough="true" fallthroughContext="dotRepeat">
  414.        <DetectSpaces attribute="Normal Text" context="#stay"/>
  415.        <DetectChar attribute="Directives" context="#pop!Arguments" char="=" />
  416.        <WordDetect attribute="Directives" context="#pop!Arguments" String="DEFL"/>
  417.        <WordDetect attribute="Directives" context="#pop!Arguments" String="defl"/>
  418.        <WordDetect attribute="Directives" context="#pop!Arguments" String="EQU"/>
  419.        <WordDetect attribute="Directives" context="#pop!Arguments" String="equ"/>
  420.      </context>
  421.  
  422.      <context name="dotRepeat" attribute="Directives" lineEndContext="LabelLine" fallthrough="true" fallthroughContext="Normal">
  423.        <DetectSpaces attribute="Normal Text" context="#stay"/>
  424.        <RegExpr attribute="Directives" context="#pop!Normal" String="\.(\d+|\(.*?\))\s"/>
  425.      </context>
  426.      <context name="Normal" attribute="Normal Text" lineEndContext="LabelLine"
  427.               lineEmptyContext="LabelLine" fallthrough="true" fallthroughContext="Arguments">
  428.        <!-- "normal" line, but without the label at beginning -->
  429.        <DetectSpaces attribute="Normal Text" context="#stay"/>
  430.        <IncludeRules context="BeginComment" />
  431.        <WordDetect attribute="Data" context="Hexastring" insensitive="true" String="hex"/>
  432.        <WordDetect attribute="Data" context="Hexastring" insensitive="true" String="dh"/>
  433.        <WordDetect attribute="Data" context="Hexastring" insensitive="true" String="defh"/>
  434.        <WordDetect attribute="Data" context="Bitstring" insensitive="true" String="dg"/>
  435.        <WordDetect attribute="Data" context="Bitstring" insensitive="true" String="defg"/>
  436.        <RegExpr attribute="Z80N Flow ins." context="Error" insensitive="true"
  437.                 String="jp\s+\(c\)\s*"/>
  438.        <RegExpr attribute="Control Flow ins." context="Arguments" insensitive="true"
  439.                 String="(call|jp)\s+(nz|z|nc|c|po|pe|p|m|ns|s)\s*,"/>
  440.        <RegExpr attribute="Control Flow ins." context="Arguments" insensitive="true"
  441.                 String="jr\s+(nz|z|nc|c)\s*,"/>
  442.        <RegExpr attribute="Control Flow ins." context="Error" insensitive="true"
  443.                 String="ret\s+(nz|z|nc|c|po|pe|p|m|ns|s)\b\s*"/>
  444.        <RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
  445.                 String="(in\s+(f,\s*|)\(c\)|out\s+\(c\),\s*0\b)\s*"/>
  446.        <RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
  447.                 String="(rlc|rrc|rl|rr|sla|sll|sra|sli|sl1|srl)\s+\(\s*(ix|iy)\s*(\+|\-)[^;]*\),\s*[a-ehl]\b\s*"/>
  448.        <RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
  449.                 String="(res|set)\s+[0-7],\s*\(\s*(ix|iy)\s*(\+|\-)[^;]*\),\s*[a-ehl]\b\s*"/>
  450.        <RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
  451.                 String="(inc|dec|sub|and|or|xor|cp)\s+i[xy][lh]\b\s*"/>
  452.        <RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
  453.                 String="(add|adc|sub|and|or|xor|cp)\s+a,\s*i[xy][lh]\b\s*"/>
  454.        <RegExpr attribute="Unofficial ins." context="Arguments" insensitive="true"
  455.                 String="ld\s+i[xy][lh],\s*"/>
  456.        <RegExpr attribute="Unofficial ins." context="Error" insensitive="true"
  457.                 String="ld\s+[a-e],\s*i[xy][lh]\b\s*"/>
  458.        <keyword attribute="Control Flow ins." context="Arguments" String="flow-instructions"/>
  459.        <keyword attribute="Unofficial ins." context="Arguments" String="instructions-unofficial"/>
  460.        <keyword attribute="Z80N Instructions" context="Arguments" String="instructions-z80n"/>
  461.        <keyword attribute="Instructions" context="Arguments" String="instructions"/>
  462.        <keyword attribute="Data" context="Arguments" String="data"/>
  463.        <!-- inlined LUA script block detection -->
  464.        <RegExpr attribute="Directives" context="LuaInlinedScript_Enter"
  465.                 String="\.?(lua|LUA)\b(\s+(PASS[123]|pass[123]|ALLPASS|allpass)|)\s*"/>
  466.        <!-- directives detection is defined twice, to detect the directives starting with dot -->
  467.        <DetectChar attribute="Directives" char=".">
  468.            <WordDetect context="sourceEnd" String="end"/>
  469.            <WordDetect context="sourceEnd" String="END"/>
  470.            <WordDetect context="Arguments" String="defarray+"/>
  471.            <WordDetect context="Arguments" String="DEFARRAY+"/>
  472.            <keyword context="Arguments" String="directives"/>
  473.        </DetectChar>
  474.        <!-- end is defined twice (not "insensitive"), b/c "End" is label!, only all-up/all-low is -->
  475.        <WordDetect attribute="Directives" context="sourceEnd" String="end"/>
  476.        <WordDetect attribute="Directives" context="sourceEnd" String="END"/>
  477.        <!-- defarray+ can't be found by keyword because of "+" being delimiter, when weak delimiter, then "(ix+1)" is not register :/ -->
  478.         <WordDetect attribute="Directives" context="Arguments" String="defarray+"/>
  479.         <WordDetect attribute="Directives" context="Arguments" String="DEFARRAY+"/>
  480.         <keyword attribute="Directives" context="Arguments" String="directives"/>
  481.       </context>
  482.  
  483.       <!-- After "END" directive show everything as comment -->
  484.       <context name="sourceEnd" attribute="Comment" lineEndContext="#stay" />
  485.  
  486.       <context name="Error" attribute="Error" lineEndContext="#pop">
  487.         <DetectChar attribute="Normal Text" context="#pop#pop!dotRepeat" char=":"/>
  488.         <DetectChar attribute="Comment" context="Comment" char=";"/>
  489.         <Detect2Chars attribute="Comment" context="Comment" char="/" char1="/"/>
  490.       </context>
  491.  
  492.       <!-- "Hexastring" highlight for DEFH/DH/HEX directive -->
  493.       <context name="Hexastring" attribute="Normal Text" lineEndContext="#pop"
  494.                fallthrough="true" fallthroughContext="#pop!Error">
  495.         <DetectChar attribute="Comment" context="HexastringQuoted" char="&quot;"/>
  496.         <DetectChar attribute="Comment" context="HexastringQuoted" char="'"/>
  497.         <DetectChar attribute="Comment" context="#stay" char=","/>
  498.         <DetectSpaces attribute="Normal Text" context="#stay"/>
  499.         <IncludeRules context="BeginComment" />
  500.         <RegExpr attribute="BaseN" context="#stay" String="([0-9A-Fa-f]{2})+"/>
  501.       </context>
  502.       <context name="HexastringQuoted" attribute="Normal Text" lineEndContext="#pop"
  503.                fallthrough="true" fallthroughContext="#pop#pop!Error">
  504.         <DetectChar attribute="Comment" context="#pop" char="&quot;"/>
  505.         <DetectChar attribute="Comment" context="#pop" char="'"/>
  506.         <DetectSpaces attribute="Normal Text" context="#stay"/>
  507.         <RegExpr attribute="BaseN" context="#stay" String="([0-9A-Fa-f]{2})+"/>
  508.       </context>
  509.  
  510.       <!-- "Bitstring" highlight for DEFG/DG directive -->
  511.       <context name="Bitstring" attribute="Data" lineEndContext="#pop"
  512.                fallthrough="true" fallthroughContext="#pop!Error">
  513.         <DetectSpaces attribute="Comment" context="#stay"/>
  514.         <AnyChar String="&quot;'" attribute="Comment" context="#stay"/>
  515.         <RegExpr attribute="Data" context="BitstringBits" lookAhead="true" String="(([^\s&quot;';][ \t]*){7}[^\s&quot;';])(.*)$"/>
  516.       </context>
  517.       <context name="BitstringBits" attribute="Data" lineEndContext="#pop#pop" dynamic="true">
  518.         <RegExpr attribute="Data" context="#pop" String="%3$" lookAhead="true" dynamic="true" />
  519.         <RegExpr String="[-._ \t]" attribute="Data" context="#stay" />
  520.         <RegExpr String="." attribute="Number" context="#stay" />
  521.       </context>
  522.  
  523.       <!-- "arguments" = generally anything what is not detected as instruction/directive or is comming after instruction -->
  524.       <context name="Arguments" attribute="Normal Text" lineEndContext="#pop">
  525.         <IncludeRules context="BeginComment" />
  526.         <DetectChar attribute="Normal Text" context="#pop#pop!dotRepeat" char=":"/>
  527.         <DetectChar attribute="String" context="StringApostrophe" char="'"/>
  528.         <DetectChar attribute="String" context="String" char="&quot;"/>
  529.         <keyword attribute="Registers" context="#stay" String="registers"/>
  530.         <keyword attribute="Normal Text" context="#stay" String="operators"/>
  531.         <RegExpr attribute="Label" context="#stay" String="(\.|@|)[A-Za-z_][A-Za-z0-9_.?!#@]*"/>
  532.         <!-- temporary labels may be mistaken for binary number ("1b"), for 1-3 digits it's temporary label -->
  533.        <RegExpr attribute="Label" context="#stay" String="\d{1,3}[bBfF]\b"/>
  534.        <RegExpr attribute="Label" context="#stay" String="\d+_[bBfF]\b"/>  <!-- v1.19.0 temporary label syntax -->
  535.        <!-- TODO but some DEFINE/macro-arg identifiers can avoid labels rules, like ".._" is valid! -->
  536.        <!-- hexadecimal numbers -->
  537.        <RegExpr attribute="BaseN" context="#stay" insensitive="true" String="((\$|0x|#)[a-f0-9]('?[a-f0-9]+)*|[0-9]('?[a-f0-9]+)*h)\b"/>
  538.        <!-- octal numbers -->
  539.        <RegExpr attribute="BaseN" context="#stay" insensitive="true" String="(0q[0-7]('?[0-7]+)*|[0-7]('?[0-7]+)*(q|o))\b"/>
  540.        <!-- binary numbers -->
  541.        <RegExpr attribute="BaseN" context="#stay" insensitive="true" String="((%|0b)[01]('?[01]+)*|[01]('?[01]+)*b)\b"/>
  542.        <!-- decimal numbers -->
  543.        <RegExpr attribute="Number" context="#stay" insensitive="true" String="\d('?\d+)*d?\b"/>
  544.        <Detect2Chars attribute="Number" context="#stay" char="$" char1="$"/>
  545.        <DetectChar attribute="Number" context="#stay" char="$"/>
  546.        <AnyChar String="!~+-*/%&lt;>?=&amp;^|[]()," attribute="Normal Text" context="#stay"/>
  547.      </context>
  548.  
  549.      <!-- Comments, rules and contexts -->
  550.      <context name="BeginComment" attribute="Comment" lineEndContext="#pop">
  551.        <!-- this context just hold rules for starting comment, shouldn't be switched to -->
  552.        <DetectChar attribute="Comment" context="Comment" char=";"/>
  553.        <Detect2Chars attribute="Comment" context="Comment" char="/" char1="/"/>
  554.        <Detect2Chars attribute="Comment" context="CommentB" char="/" char1="*" beginRegion="Comment"/>
  555.        <Detect2Chars attribute="Error" context="Error" char="*" char1="/"/>
  556.      </context>
  557.      <context name="Comment" attribute="Comment" lineEndContext="#pop">
  558.          <DetectSpaces />
  559.          <RegExpr attribute="Alert" context="#stay" String="\b(TODO|FIX\s?ME|DEBUG)\b"/>
  560.      </context>
  561.      <context name="CommentB" attribute="Comment" lineEndContext="#stay">  <!-- block multiline comment /* */ -->
  562.          <IncludeRules context="Comment" />
  563.          <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment" />
  564.          <!-- in sjasmplus the block comments actually can be nested! -->
  565.          <Detect2Chars attribute="Comment" context="CommentB" char="/" char1="*" beginRegion="Comment"/>
  566.      </context>
  567.  
  568.      <!-- Strings -->
  569.      <context name="StringEscape" attribute="Char" fallthrough="true" fallthroughContext="#pop#pop!Error">
  570.          <AnyChar String="\?'&quot;0AaBbDdEeFfNnRrTtVv" attribute="Char" context="#pop"/>
  571.      </context>
  572.      <context name="String" attribute="String" lineEndContext="#pop">
  573.        <DetectChar attribute="Char" context="StringEscape" char="\"/>
  574.        <DetectChar attribute="String" context="#pop" char="&quot;"/>
  575.      </context>
  576.      <context name="StringApostrophe" attribute="String" lineEndContext="#pop">
  577.        <Detect2Chars attribute="Char" context="#stay" char="'" char1="'"/>
  578.        <DetectChar attribute="String" context="#pop" char="'"/>
  579.      </context>
  580.  
  581.        <context name="LuaInlinedScript_Enter" attribute="Error" lineEndContext="#pop!LuaInlinedScript">
  582.            <DetectChar attribute="Comment" context="Comment" char=";"/>
  583.            <Detect2Chars attribute="Comment" context="Comment" char="/" char1="/"/>
  584.        </context>
  585.        <context name="LuaInlinedScript" attribute="Normal Text" lineEndContext="#stay">
  586.            <DetectChar attribute="Directives" char=".">
  587.                <WordDetect context="#pop!Error" String="endlua"/>
  588.                <WordDetect context="#pop!Error" String="ENDLUA"/>
  589.            </DetectChar>
  590.            <WordDetect attribute="Directives" context="#pop!Error" String="endlua"/>
  591.            <WordDetect attribute="Directives" context="#pop!Error" String="ENDLUA"/>
  592.            <IncludeRules context="Normal##Lua"/>
  593.        </context>
  594.  
  595.    </contexts>
  596.  
  597.    <itemDatas>
  598.      <itemData name="Normal Text" defStyleNum="dsNormal"/>
  599.      <itemData name="Error" defStyleNum="dsError"/>
  600.      <itemData name="Registers" defStyleNum="dsVariable"/>
  601.      <itemData name="Instructions" defStyleNum="dsKeyword"/>
  602.      <itemData name="Unofficial ins." defStyleNum="dsExtension"/>
  603.      <itemData name="Z80N Instructions" defStyleNum="dsKeyword"/>
  604.      <itemData name="Z80N Flow ins." defStyleNum="dsControlFlow"/>
  605.      <itemData name="Control Flow ins." defStyleNum="dsControlFlow"/>
  606.      <itemData name="Directives" defStyleNum="dsPreprocessor"/>
  607.      <itemData name="Comment" defStyleNum="dsComment"/>
  608.      <itemData name="Alert" defStyleNum="dsAlert"/>
  609.      <itemData name="Label" defStyleNum="dsFunction"/>
  610.      <itemData name="Data" defStyleNum="dsDataType"/>
  611.      <itemData name="BaseN" defStyleNum="dsBaseN"/>
  612.      <itemData name="Float" defStyleNum="dsFloat"/>
  613.      <itemData name="Number" defStyleNum="dsDecVal"/>
  614.      <itemData name="Char" defStyleNum="dsChar"/>
  615.      <itemData name="String" defStyleNum="dsString"/>
  616.    </itemDatas>
  617.  </highlighting>
  618.  <general>
  619.    <keywords casesensitive="0" additionalDeliminator="`"/>
  620.    <comments>
  621.      <comment name="singleLine" start=";" />
  622.      <comment name="multiLine" start="/*" end="*/" />
  623.    </comments>
  624.  </general>
  625. </language>
  626. <!-- kate: space-indent on; indent-width 2; replace-tabs on; -->
  627.