?login_element?

Subversion Repositories NedoOS

Rev

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