Debian Codegraph @

syntax/GtkSourceView-6502_64tass.lang

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- ex:set ts=2 et:
3
4 $Id: GtkSourceView-6502_64tass.lang 3179 2025-03-26 06:31:53Z soci $
5
6 GtkSourceView language definition file for 64tass
7 Usable with gedit
8
9 Place it to one/both of these folder:
10
11 ~/.local/share/gtksourceview-2.0/language-specs/
12 ~/.local/share/gtksourceview-3.0/language-specs/
13 ~/.local/share/gtksourceview-4/language-specs/
14
15 Author: Zsolt Kajtar <soci at c64.rulez.org>
16 Copyright (C) 2012 Zsolt Kajtar <soci at c64.rulez.org>
17
18 Original-Author: Alex Brem <[email protected]>
19 Copyright (C) 2009 Alex Brem <[email protected]>
20
21 This library is free software; you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation; either version 2 of the License, or
24 (at your option) any later version.
25
26 This program is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 GNU General Public License for more details.
30
31 You should have received a copy of the GNU General Public License
32 along with this program; if not, write to the Free Software
33 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34
35 -->
36 <language id="tass6502" _name="6502 assembly (64tass)" version="2.0" _section="Sources">
37
38 <metadata>
39 <property name="mimetypes">text/x-64tass;application/x-64tass</property>
40 <property name="globs">*.asm</property>
41 <property name="line-comment-start">;</property>
42 </metadata>
43
44 <styles>
45 <style id="comment" _name="Comment" map-to="def:comment"/>
46 <style id="opcode" _name="Opcode" map-to="def:keyword"/>
47 <style id="illegal-opcode" _name="Illegal Opcode" map-to="def:special-constant"/>
48 <style id="operator" _name="Operator" map-to="def:operator"/>
49 <style id="register" _name="Register" map-to="def:keyword"/>
50 <style id="definition" _name="Definition" map-to="def:type"/>
51 <style id="string" _name="String" map-to="def:string"/>
52 <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
53 <style id="base-n-integer" _name="Base-N number" map-to="def:base-n-integer"/>
54 <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
55 <style id="label" _name="Label" map-to="def:identifier"/>
56 <style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
57 </styles>
58
59 <default-regex-options case-sensitive="false"/>
60
61 <definitions>
62
63 <context id="tass6502">
64 <include>
65 <context ref="opcode"/>
66 <context ref="illegal-opcode"/>
67 <context ref="label"/>
68 <context ref="comment"/>
69 <context ref="miscprep"/>
70 </include>
71 </context>
72
73 <context id="comment" style-ref="comment" end-at-line-end="true" end-parent="true">
74 <start>;</start>
75 </context>
76
77
78 <context id="double-quoted-string">
79 <include>
80 <context style-ref="string">
81 <start>[bnlspxz]?"</start><end>"</end>
82 </context>
83 <context style-ref="string">
84 <start>[bnlspxz]?'</start><end>'</end>
85 </context>
86 </include>
87 </context>
88
89 <context id="decimal" style-ref="decimal">
90 <match>(?&lt;![\w\.])(([0-9]_+)+[0-9]|[0-9])+(?![\w\.])</match>
91 </context>
92
93 <context id="hex" style-ref="base-n-integer">
94 <match>(?&lt;![\w\.])\$(([0-9a-f]_+)+[0-9a-f]|[0-9a-f])+(?![\w\.])</match>
95 </context>
96
97 <context id="binary" style-ref="base-n-integer">
98 <match>(?&lt;![\w\.])%(([01]_+)+[01]|[01])+(?![\w\.])</match>
99 </context>
100
101 <context id="float" style-ref="floating-point">
102 <match>(?&lt;![\w\.])((\.(([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])+)(?![\w\.])</match>
103 </context>
104
105 <context id="hfloat" style-ref="floating-point">
106 <match>(?&lt;![\w\.])\$((\.(([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])+)(?![\w\.])</match>
107 </context>
108
109 <context id="bfloat" style-ref="floating-point">
110 <match>(?&lt;![\w\.])%((\.(([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])+)(?![\w\.])</match>
111 </context>
112
113 <context id="identifier" style-ref="label">
114 <match>(?&lt;!\w)([[:alpha:]][[:alnum:]_]*|_[[:alnum:]][[:alnum:]_]*)</match>
115 </context>
116
117 <context id="preidentifier" style-ref="preprocessor">
118 <match>\\[[:alpha:]][[:alnum:]_]*|\\[1-9@]|\\\{[^}]*\}</match>
119 </context>
120
121 <context id="label" end-at-line-end="true">
122 <start>[[:alpha:]][[:alnum:]_]*:?|_[[:alnum:]][[:alnum:]_]*:?|\*</start>
123 <include>
124 <context ref="opcode"/>
125 <context ref="illegal-opcode"/>
126 <context ref="comment"/>
127 <context ref="miscprep"/>
128 <context end-at-line-end="true">
129 <start>=</start>
130 <include>
131 <context ref="miscparam"/>
132 </include>
133 </context>
134 </include>
135 </context>
136
137 <context id="operator" style-ref="operator">
138 <match>[-+!~&lt;&gt;&amp;,.|^*/%=(){}\[\]?:`#]</match>
139 </context>
140
141 <context id="register" style-ref="register">
142 <match>,[xyzsrdbk]\b</match>
143 </context>
144
145 <context id="miscparam">
146 <include>
147 <context ref="double-quoted-string"/>
148 <context ref="identifier"/>
149 <context ref="preidentifier"/>
150 <context ref="bfloat"/>
151 <context ref="hfloat"/>
152 <context ref="float"/>
153 <context ref="decimal"/>
154 <context ref="hex"/>
155 <context ref="binary"/>
156 <context ref="operator"/>
157 <context ref="comment"/>
158 </include>
159 </context>
160
161 <context id="opcode" end-at-line-end="true">
162 <start>(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|(?=;)|$))?|(?=;)|$)</start>
163 <include>
164 <context sub-pattern="0" where="start" style-ref="opcode"/>
165 <context sub-pattern="1" where="start" style-ref="opcode"/>
166 <context ref="register"/>
167 <context ref="miscparam"/>
168 </include>
169 </context>
170
171 <context id="illegal-opcode" end-at-line-end="true">
172 <start>(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|(?=;)|$)</start>
173 <include>
174 <context sub-pattern="0" where="start" style-ref="illegal-opcode"/>
175 <context ref="register"/>
176 <context ref="miscparam"/>
177 </include>
178 </context>
179
180 <context id="miscprep">
181 <include>
182 <context ref="definition"/>
183 <context ref="preprocessor-include"/>
184 <context ref="preprocessor-macro"/>
185 <context ref="preprocessor-loop"/>
186 <context ref="preprocessor-cond"/>
187 <context ref="preprocessor-misc"/>
188 <context ref="mcomment"/>
189 </include>
190 </context>
191
192 <context id="preprocessor-include" end-at-line-end="true">
193 <start>\.b?include(\s|(?=;)|$)</start>
194 <include>
195 <context sub-pattern="0" where="start" style-ref="preprocessor"/>
196 <context ref="miscparam"/>
197 </include>
198 </context>
199
200 <context id="preprocessor-macro" end-at-line-end="true">
201 <start>\.((end)?macro|(end)?segment|endm|(end)?function|endf|sfunction)(\s|(?=;)|$)|[#.]([[:alpha:]][[:alnum:]_]*|_[[:alnum:]][[:alnum:]_]*)(\s|(?=;)|$)</start>
202 <include>
203 <context sub-pattern="0" where="start" style-ref="preprocessor"/>
204 <context ref="miscparam"/>
205 </include>
206 </context>
207
208 <context id="preprocessor-loop" end-at-line-end="true">
209 <start>\.(b?for|b?rept|b?while|next|endfor|endrept|endwhile|lbl|goto)(\s|(?=;)|$)</start>
210 <include>
211 <context sub-pattern="0" where="start" style-ref="preprocessor"/>
212 <context ref="miscparam"/>
213 </include>
214 </context>
215
216 <context id="preprocessor-cond" end-at-line-end="true">
217 <start>\.(if|ifne|ifeq|ifpl|ifmi|elif|else|elsif|fi|endif|switch|case|default|endswitch|c?error|c?warn)(\s|(?=;)|$)</start>
218 <include>
219 <context sub-pattern="0" where="start" style-ref="preprocessor"/>
220 <context ref="miscparam"/>
221 </include>
222 </context>
223
224 <context id="preprocessor-misc" end-at-line-end="true">
225 <start>\.((end)?struct|(end)?union|(end)?page|end[uspnv]|d?section|endsection|(end)?block|(end)?proc|[sbp]end|(end)?logical|here|[ax][ls]|autsiz|mansiz|pron|proff|(end)?namespace|(end)?weak|alignpageind|alignind|(end)?alignblk|hidemac|showmac|offs|align|assert|check|[cet]def|databank|dpage|cpu|option|var|from|end|eor|seed|breakif|continueif|break|continue|(end)?virtual|(end)?with|(end)?encode|enc)(\s|(?=;)|$)</start>
226 <include>
227 <context sub-pattern="0" where="start" style-ref="preprocessor"/>
228 <context ref="miscparam"/>
229 </include>
230 </context>
231
232 <context id="definition" end-at-line-end="true">
233 <start>\.(byte|char|[lsd]int|rta|long|d?word|fill|p?text|null|shiftl?|binary|dstruct|dunion|addr)(\s|(?=;)|$)</start>
234 <include>
235 <context sub-pattern="0" where="start" style-ref="definition"/>
236 <context ref="miscparam"/>
237 </include>
238 </context>
239
240 <context id="mcomment" style-ref="comment" style-inside="true">
241 <start>\.comment(\s|(?=;)|$)</start>
242 <end>\.endc(omment)?(\s|(?=;)|$)</end>
243 <include>
244 <context sub-pattern="0" where="start" style-ref="preprocessor"/>
245 <context sub-pattern="0" where="end" style-ref="preprocessor"/>
246 </include>
247 </context>
248
249 </definitions>
250
251 </language>