<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
        <!ENTITY opcode    "\b(adc|and|asl|bcc|bcs|beq|bge|bit|blt|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpa|cpx|cpy|dec|dex|dey|eor|gcc|gcs|geq|gge|glt|gmi|gne|gpl|gvc|gvs|inc|inx|iny|jmp|jsr|lda|ldr|ldx|ldy|lsr|nop|ora|orr|pha|php|pla|plp|psh|pul|rol|ror|rti|rts|sbc|sec|sed|sei|shl|shr|sta|str|stx|sty|tax|tay|tsx|txa|txs|tya)((?:\s+(a(?=(\s|;|$))))|(?=(\s|;|$)))">
        <!ENTITY iopcode   "\b(ahx|alr|anc|ane|arr|asr|axs|dcm|dcp|ins|isb|isc|jam|lae|las|lax|lds|lxa|rla|rra|sax|sbx|sha|shs|shx|shy|slo|sre|tas|xaa)((?:\s+(#|a(?=(\s|;|$))))|(?=(\s|;|$)))">
        <!ENTITY datadef   "\.(byte|char|[lsd]int|rta|long|d?word|fill|p?text|null|shiftl?|dstruct|dunion|binary|addr)\b">
        <!ENTITY preproc   "\.(b?include|lbl|goto|from|c?error|c?warn|[ax][ls]|autsiz|mansiz|pron|proff|hidemac|showmac|offs|alignpageind|alignind|alignblk|align|assert|check|[cet]def|databank|dpage|cpu|enc|option|var|end|eor|seed|dsection|breakif|continueif|break|continue|sfunction)\b">
]>
<!-- ex:set ts=2 et:

 $Id: katepart-asm6502.xml 3179 2025-03-26 06:31:53Z soci $

 Katepart language definition file for 64tass
 Usable with kwrite, kate, kdevelop

 Depending on the version of KDE place it into one of these folders:

 ~/.kde/share/apps/katepart/syntax
 ~/.local/share/katepart5/syntax
 ~/.local/share/org.kde.syntax-highlighting/syntax

 Author: Zsolt Kajtar <soci at c64.rulez.org>
 Copyright (C) 2012 Zsolt Kajtar <soci at c64.rulez.org>

 This library is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

-->
<language name="6502 assembly (64tass)" version="1.05" kateversion="2.1" section="Assembler" extensions="*.asm" mimetype="text/x-64tass;application/x-64tass">
  <highlighting>
    <contexts>
      <context name="Base" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="Opcode"/>
        <RegExpr String="((?![0-9])\w[\w_.]*|_\w[\w_.]*):?" context="Opcode2" insensitive="TRUE"/>
        <RegExpr String="[+\-*](?=(\s|$|=))" context="Opcode2" insensitive="TRUE"/>
      </context>
      <context name="Opcode2" attribute="Normal Text" lineEndContext="Base">
        <RegExpr String="(&lt;&lt;|&gt;&gt;|&amp;&amp;|\|\||\*\*|\.\.|::|[&lt;&gt;:]\?|[-+*%/&amp;|^.:x])?=" attribute="Keyword" context="Miscparam" insensitive="TRUE"/>
        <IncludeRules context="Opcode"/>
      </context>

      <context name="Opcode" lineEndContext="#pop">
        <RegExpr String="&opcode;" attribute="Keyword" context="Miscparam" insensitive="TRUE"/>
        <RegExpr String="&iopcode;" attribute="Keyword" context="Miscparam" insensitive="TRUE"/>
        <RegExpr String="&datadef;" attribute="Data Type" context="Miscparam" insensitive="TRUE"/>
        <RegExpr String="&preproc;" attribute="Preprocessor" context="Miscparam" insensitive="TRUE"/>
        <RegExpr context="folding" beginRegion="foldingRegion" String="\.comment\b" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr String="#(\\?((?![0-9])\w[\w_.]*|_\w[\w_.]*)|\\[1-9@])\b" attribute="Preprocessor" context="Miscparam" insensitive="TRUE"/>
        <IncludeRules context="foldstuff"/>
        <RegExpr String=";.*$" attribute="Comment" context="#stay"/>
      </context>
      <context name="Miscparam" attribute="Normal Text" lineEndContext="Base">
        <RegExpr String="[\-+]+\s*(?=($|[)},;.\]]))" attribute="Label" context="Miscparam2"/>
        <RegExpr String="[bnlspxz]&quot;" attribute="String" context="string1"/>
        <RegExpr String="[bnlspxz]'" attribute="String" context="string2"/>
        <RegExpr String="((?![0-9])\w[\w_]*|_\w[\w_]*)\s*(?=\()" attribute="Normal Text" context="#stay" insensitive="TRUE"/>
        <RegExpr String="(?![0-9])\w[\w_]*|_\w[\w_]*" attribute="Label" context="Miscparam2" insensitive="TRUE"/>
        <RegExpr String="\\((?![0-9])\w[\w_]*|_\w[\w_]*)" attribute="Preprocessor" context="Miscparam2" insensitive="TRUE"/>
        <RegExpr String="\\\{((?![0-9])\w[\w_]*|_\w[\w_]*)\}" attribute="Preprocessor" context="Miscparam" insensitive="TRUE"/>
        <RegExpr String="\\[@1-9]" attribute="Preprocessor" context="Miscparam2" insensitive="TRUE"/>
        <RegExpr String="%((\.(([01]_+)+[01]|[01])+|(([01]_+)+[01]|[01])+\.(?!\.)(([01]_+)+[01]|[01])*)([ep][+-]?(([0-9]_+)+[0-9]|[0-9])+)?|(([01]_+)+[01]|[01])+[ep][+-]?(([0-9]_+)+[0-9]|[0-9])+)" attribute="Float" context="Miscparam2" insensitive="TRUE"/>
        <RegExpr String="%(([01]_+)+[01]|[01])*" attribute="Bin" context="Miscparam2"/>
        <RegExpr String="[*?]" attribute="Hex" context="Miscparam2"/>
        <RegExpr String="@[bwl]" attribute="Operator" context="#stay"/>
        <RegExpr String="(\.(([0-9]_+)+[0-9]|[0-9])+|(([0-9]_+)+[0-9]|[0-9])+\.(?!\.)(([0-9]_+)+[0-9]|[0-9])*)([ep][+-]?(([0-9]_+)+[0-9]|[0-9])+)?|(([0-9]_+)+[0-9]|[0-9])+[ep][+-]?(([0-9]_+)+[0-9]|[0-9])+" attribute="Float" context="Miscparam2" insensitive="TRUE"/>
        <RegExpr String="(([0-9]_+)+[0-9]|[0-9])+" attribute="Decimal" context="Miscparam2"/>
        <RegExpr String="\$((\.(([0-9a-f]_+)+[0-9a-f]|[0-9a-f])+|(([0-9a-f]_+)+[0-9a-f]|[0-9a-f])+\.(?!\.)(([0-9a-f]_+)+[0-9a-f]|[0-9a-f])*)(p[+-]?(([0-9]_+)+[0-9]|[0-9])+)?|(([0-9a-f]_+)+[0-9a-f]|[0-9a-f])+p[+-]?(([0-9]_+)+[0-9]|[0-9])+)" attribute="Float" context="Miscparam2" insensitive="TRUE"/>
        <RegExpr String="\$(([0-9a-f]_+)+[0-9a-f]|[0-9a-f])*" attribute="Hex" context="Miscparam2" insensitive="TRUE"/>
        <RegExpr String="\.[([]"  attribute="Operator" context="#stay"/>
        <RegExpr String="\.(?![0-9])(?=\w)"  attribute="Operator" context="#stay"/>
        <RegExpr String="[,({\[+\-!~&lt;&gt;#`\^:]"  attribute="Operator" context="#stay"/>
        <RegExpr String="[)}\]]"  attribute="Operator" context="Miscparam2"/>
        <DetectChar char="&quot;" attribute="String" context="string1"/>
        <DetectChar char="'" attribute="String" context="string2"/>
        <RegExpr String=";.*$" attribute="Comment" context="#pop"/>
        <RegExpr String="[^ \t]" attribute="Error" context="#stay"/>
      </context>
      <context name="Miscparam2" attribute="Normal Text" lineEndContext="Base">
        <RegExpr String=",[xyzrsdbk]\b"  attribute="Operator" context="#stay"/>
        <RegExpr String="[)}\]]"  attribute="Operator" context="#stay"/>
        <RegExpr String="&amp;&amp;|\|\||^^|\*\*|\.\.|\?\?|[=!]==?|&lt;=&gt;|&lt;[&lt;=?]|&gt;[&gt;=?]|\bx\b|!?\bin\b"  attribute="Operator" context="Miscparam"/>
        <RegExpr String="[,({\[&amp;|^*%/\-+.?:=&lt;&gt;]"  attribute="Operator" context="Miscparam"/>
        <RegExpr String=";.*$" attribute="Comment" context="#pop"/>
        <RegExpr String="[^ \t]" attribute="Error" context="#stay"/>
      </context>
      <context name="string1" lineEndContext="Base" attribute="String">
        <Detect2Chars attribute="Preprocessor" context="#stay" char="&quot;" char1="&quot;"/>
        <RegExpr String="\{[^}&quot;]*\}" attribute="Preprocessor" context="#stay"/>
        <DetectChar attribute="String" context="Miscparam2" char="&quot;"/>
      </context>
      <context name="string2" lineEndContext="Base" attribute="String">
        <Detect2Chars attribute="Preprocessor" context="#stay" char="'" char1="'"/>
        <RegExpr String="\{[^}']*\}" attribute="Preprocessor" context="#stay"/>
        <DetectChar attribute="String" context="Miscparam2" char="'"/>
      </context>
      <context name="Error" attribute="Error" lineEndContext="Base">
      </context>
      <context name="foldstuff">
        <RegExpr beginRegion="proc" String="\.proc\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="proc" String="\.(pend|endproc)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="block" String="\.block\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="block" String="\.(bend|endblock)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="encode" String="\.encode\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="encode" String="\.endencode\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="section" String="\.section\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="section" String="\.(send|endsection)\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="struct" String="\.struct\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="struct" String="\.(ends|endstruct)\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="union" String="\.union\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="union" String="\.(endu|endunion)\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="page" String="\.page\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="page" String="\.(endp|endpage)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="namespace" String="\.namespace\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="namespace" String="\.(endn|endnamespace)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="with" String="\.with\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="with" String="\.endwith\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="segment" String="\.segment\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="segment" String="\.(endm|endsegment)\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="macro" String="\.macro\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="macro" String="\.(endm|endmacro)\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="function" String="\.function\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="function" String="\.(endf|endfunction)\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="for" String="\.b?for\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="for" String="\.(next|endfor)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="rept" String="\.b?rept\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="rept" String="\.(next|endrept)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="while" String="\.b?while\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="while" String="\.(next|endwhile)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="logical" String="\.logical\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="logical" String="\.(here|endlogical)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="virtual" String="\.virtual\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="virtual" String="\.(endv|endvirtual)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="weak" String="\.weak\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="weak" String="\.endweak\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="alignblk" String="\.alignblk\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="alignblk" String="\.endalignblk\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="if" String="\.(if|ifeq|ifne|ifpl|ifmi)\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="if" beginRegion="if" String="\.els?if\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="if" beginRegion="if" String="\.else\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="if" String="\.(fi|endif)\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr beginRegion="switch" String="\.switch\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="switch" beginRegion="switch" String="\.case\b" context="Miscparam" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="switch" beginRegion="switch" String="\.default\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
        <RegExpr endRegion="switch" String="\.endswitch\b" context="Error" attribute="Preprocessor" insensitive="TRUE"/>
      </context>

      <context attribute="Comment" name="folding" lineEndContext="#stay">
        <RegExpr context="#pop" endRegion="foldingRegion" String="\.(endc|endcomment)\b" attribute="Preprocessor" insensitive="TRUE"/>
      </context>
    </contexts>

    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal"/>
      <itemData name="Label" defStyleNum="dsFunction"/>
      <itemData name="Keyword" defStyleNum="dsKeyword"/>
      <itemData name="Decimal" defStyleNum="dsDecVal"/>
      <itemData name="Float" defStyleNum="dsFloat"/>
      <itemData name="Data Type" defStyleNum="dsDataType"/>
      <itemData name="Hex" defStyleNum="dsBaseN"/>
      <itemData name="Bin" defStyleNum="dsBaseN"/>
      <itemData name="String" defStyleNum="dsString"/>
      <itemData name="Comment" defStyleNum="dsComment"/>
      <itemData name="Preprocessor" defStyleNum="dsOthers"/>
      <itemData name="Operator" defStyleNum="dsNormal"/>
      <itemData name="Error" defStyleNum="dsError"/>
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="singleLine" start=";"/>
    </comments>
    <keywords casesensitive="1"/>
  </general>
</language>

