2 " Language: (VAX) Macro Assembly
3 " Maintainer: Tom Uijldert <tom.uijldert [at] cmg.nl>
4 " Last change: 2004 May 16
6 " This is incomplete. Feel free to contribute...
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when a syntax file was already loaded
13 elseif exists("b:current_syntax")
19 " Partial list of register symbols
20 syn keyword vmasmReg r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12
21 syn keyword vmasmReg ap fp sp pc iv dv
23 " All matches - order is important!
24 syn keyword vmasmOpcode adawi adwc ashl ashq bitb bitw bitl decb decw decl
25 syn keyword vmasmOpcode ediv emul incb incw incl mcomb mcomw mcoml
26 syn keyword vmasmOpcode movzbw movzbl movzwl popl pushl rotl sbwc
27 syn keyword vmasmOpcode cmpv cmpzv cmpc3 cmpc5 locc matchc movc3 movc5
28 syn keyword vmasmOpcode movtc movtuc scanc skpc spanc crc extv extzv
29 syn keyword vmasmOpcode ffc ffs insv aobleq aoblss bbc bbs bbcci bbssi
30 syn keyword vmasmOpcode blbc blbs brb brw bsbb bsbw caseb casew casel
31 syn keyword vmasmOpcode jmp jsb rsb sobgeq sobgtr callg calls ret
32 syn keyword vmasmOpcode bicpsw bispsw bpt halt index movpsl nop popr pushr xfc
33 syn keyword vmasmOpcode insqhi insqti insque remqhi remqti remque
34 syn keyword vmasmOpcode addp4 addp6 ashp cmpp3 cmpp4 cvtpl cvtlp cvtps cvtpt
35 syn keyword vmasmOpcode cvtsp cvttp divp movp mulp subp4 subp6 editpc
36 syn keyword vmasmOpcode prober probew rei ldpctx svpctx mfpr mtpr bugw bugl
37 syn keyword vmasmOpcode vldl vldq vgathl vgathq vstl vstq vscatl vscatq
38 syn keyword vmasmOpcode vvcvt iota mfvp mtvp vsync
39 syn keyword vmasmOpcode beql[u] bgtr[u] blss[u]
40 syn match vmasmOpcode "\<add[bwlfdgh][23]\>"
41 syn match vmasmOpcode "\<bi[cs][bwl][23]\>"
42 syn match vmasmOpcode "\<clr[bwlqofdgh]\>"
43 syn match vmasmOpcode "\<cmp[bwlfdgh]\>"
44 syn match vmasmOpcode "\<cvt[bwlfdgh][bwlfdgh]\>"
45 syn match vmasmOpcode "\<cvtr[fdgh]l\>"
46 syn match vmasmOpcode "\<div[bwlfdgh][23]\>"
47 syn match vmasmOpcode "\<emod[fdgh]\>"
48 syn match vmasmOpcode "\<mneg[bwlfdgh]\>"
49 syn match vmasmOpcode "\<mov[bwlqofdgh]\>"
50 syn match vmasmOpcode "\<mul[bwlfdgh][23]\>"
51 syn match vmasmOpcode "\<poly[fdgh]\>"
52 syn match vmasmOpcode "\<sub[bwlfdgh][23]\>"
53 syn match vmasmOpcode "\<tst[bwlfdgh]\>"
54 syn match vmasmOpcode "\<xor[bwl][23]\>"
55 syn match vmasmOpcode "\<mova[bwlfqdgho]\>"
56 syn match vmasmOpcode "\<push[bwlfqdgho]\>"
57 syn match vmasmOpcode "\<acb[bwlfgdh]\>"
58 syn match vmasmOpcode "\<b[lng]equ\=\>"
59 syn match vmasmOpcode "\<b[cv][cs]\>"
60 syn match vmasmOpcode "\<bb[cs][cs]\>"
61 syn match vmasmOpcode "\<v[vs]add[lfdg]\>"
62 syn match vmasmOpcode "\<v[vs]cmp[lfdg]\>"
63 syn match vmasmOpcode "\<v[vs]div[fdg]\>"
64 syn match vmasmOpcode "\<v[vs]mul[lfdg]\>"
65 syn match vmasmOpcode "\<v[vs]sub[lfdg]\>"
66 syn match vmasmOpcode "\<v[vs]bi[cs]l\>"
67 syn match vmasmOpcode "\<v[vs]xorl\>"
68 syn match vmasmOpcode "\<v[vs]merge\>"
69 syn match vmasmOpcode "\<v[vs]s[rl]ll\>"
71 " Various number formats
72 syn match vmasmdecNumber "[+-]\=[0-9]\+\>"
73 syn match vmasmdecNumber "^d[0-9]\+\>"
74 syn match vmasmhexNumber "^x[0-9a-f]\+\>"
75 syn match vmasmoctNumber "^o[0-7]\+\>"
76 syn match vmasmbinNumber "^b[01]\+\>"
77 syn match vmasmfloatNumber "[-+]\=[0-9]\+E[-+]\=[0-9]\+"
78 syn match vmasmfloatNumber "[-+]\=[0-9]\+\.[0-9]*\(E[-+]\=[0-9]\+\)\="
81 syn match vmasmLabel "^[a-z_$.][a-z0-9_$.]\{,30}::\="
82 syn match vmasmLabel "\<[0-9]\{1,5}\$:\=" " Local label
84 " Character string constants
85 " Too complex really. Could be "<...>" but those could also be
86 " expressions. Don't know how to handle chosen delimiters
88 " syn region vmasmString start="<" end=">" oneline
91 syn match vmasmOperator "[-+*/@&!\\]"
92 syn match vmasmOperator "="
93 syn match vmasmOperator "==" " Global assignment
94 syn match vmasmOperator "%length(.*)"
95 syn match vmasmOperator "%locate(.*)"
96 syn match vmasmOperator "%extract(.*)"
97 syn match vmasmOperator "^[amfc]"
98 syn match vmasmOperator "[bwlg]^"
100 syn match vmasmOperator "\<\(not_\)\=equal\>"
101 syn match vmasmOperator "\<less_equal\>"
102 syn match vmasmOperator "\<greater\(_equal\)\=\>"
103 syn match vmasmOperator "\<less_than\>"
104 syn match vmasmOperator "\<\(not_\)\=defined\>"
105 syn match vmasmOperator "\<\(not_\)\=blank\>"
106 syn match vmasmOperator "\<identical\>"
107 syn match vmasmOperator "\<different\>"
108 syn match vmasmOperator "\<eq\>"
109 syn match vmasmOperator "\<[gl]t\>"
110 syn match vmasmOperator "\<n\=df\>"
111 syn match vmasmOperator "\<n\=b\>"
112 syn match vmasmOperator "\<idn\>"
113 syn match vmasmOperator "\<[nlg]e\>"
114 syn match vmasmOperator "\<dif\>"
116 " Special items for comments
117 syn keyword vmasmTodo contained todo
120 syn match vmasmComment ";.*" contains=vmasmTodo
123 syn match vmasmInclude "\.library\>"
126 syn match vmasmMacro "\.macro\>"
127 syn match vmasmMacro "\.mexit\>"
128 syn match vmasmMacro "\.endm\>"
129 syn match vmasmMacro "\.mcall\>"
130 syn match vmasmMacro "\.mdelete\>"
132 " Conditional assembly
133 syn match vmasmPreCond "\.iff\=\>"
134 syn match vmasmPreCond "\.if_false\>"
135 syn match vmasmPreCond "\.iftf\=\>"
136 syn match vmasmPreCond "\.if_true\(_false\)\=\>"
137 syn match vmasmPreCond "\.iif\>"
140 syn match vmasmRepeat "\.irpc\=\>"
141 syn match vmasmRepeat "\.repeat\>"
142 syn match vmasmRepeat "\.rept\>"
143 syn match vmasmRepeat "\.endr\>"
146 syn match vmasmDirective "\.address\>"
147 syn match vmasmDirective "\.align\>"
148 syn match vmasmDirective "\.asci[cdiz]\>"
149 syn match vmasmDirective "\.blk[abdfghloqw]\>"
150 syn match vmasmDirective "\.\(signed_\)\=byte\>"
151 syn match vmasmDirective "\.\(no\)\=cross\>"
152 syn match vmasmDirective "\.debug\>"
153 syn match vmasmDirective "\.default displacement\>"
154 syn match vmasmDirective "\.[dfgh]_floating\>"
155 syn match vmasmDirective "\.disable\>"
156 syn match vmasmDirective "\.double\>"
157 syn match vmasmDirective "\.dsabl\>"
158 syn match vmasmDirective "\.enable\=\>"
159 syn match vmasmDirective "\.endc\=\>"
160 syn match vmasmDirective "\.entry\>"
161 syn match vmasmDirective "\.error\>"
162 syn match vmasmDirective "\.even\>"
163 syn match vmasmDirective "\.external\>"
164 syn match vmasmDirective "\.extrn\>"
165 syn match vmasmDirective "\.float\>"
166 syn match vmasmDirective "\.globa\=l\>"
167 syn match vmasmDirective "\.ident\>"
168 syn match vmasmDirective "\.link\>"
169 syn match vmasmDirective "\.list\>"
170 syn match vmasmDirective "\.long\>"
171 syn match vmasmDirective "\.mask\>"
172 syn match vmasmDirective "\.narg\>"
173 syn match vmasmDirective "\.nchr\>"
174 syn match vmasmDirective "\.nlist\>"
175 syn match vmasmDirective "\.ntype\>"
176 syn match vmasmDirective "\.octa\>"
177 syn match vmasmDirective "\.odd\>"
178 syn match vmasmDirective "\.opdef\>"
179 syn match vmasmDirective "\.packed\>"
180 syn match vmasmDirective "\.page\>"
181 syn match vmasmDirective "\.print\>"
182 syn match vmasmDirective "\.psect\>"
183 syn match vmasmDirective "\.quad\>"
184 syn match vmasmDirective "\.ref[1248]\>"
185 syn match vmasmDirective "\.ref16\>"
186 syn match vmasmDirective "\.restore\(_psect\)\=\>"
187 syn match vmasmDirective "\.save\(_psect\)\=\>"
188 syn match vmasmDirective "\.sbttl\>"
189 syn match vmasmDirective "\.\(no\)\=show\>"
190 syn match vmasmDirective "\.\(sub\)\=title\>"
191 syn match vmasmDirective "\.transfer\>"
192 syn match vmasmDirective "\.warn\>"
193 syn match vmasmDirective "\.weak\>"
194 syn match vmasmDirective "\.\(signed_\)\=word\>"
198 " Define the default highlighting.
199 " For version 5.7 and earlier: only when not done already
200 " For version 5.8 and later: only when an item doesn't have highlighting yet
201 if version >= 508 || !exists("did_macro_syntax_inits")
203 let did_macro_syntax_inits = 1
204 command -nargs=+ HiLink hi link <args>
206 command -nargs=+ HiLink hi def link <args>
209 " The default methods for highlighting. Can be overridden later
210 " Comment Constant Error Identifier PreProc Special Statement Todo Type
212 " Constant Boolean Character Number String
213 " Identifier Function
214 " PreProc Define Include Macro PreCondit
215 " Special Debug Delimiter SpecialChar SpecialComment Tag
216 " Statement Conditional Exception Keyword Label Operator Repeat
217 " Type StorageClass Structure Typedef
219 HiLink vmasmComment Comment
220 HiLink vmasmTodo Todo
222 HiLink vmasmhexNumber Number " Constant
223 HiLink vmasmoctNumber Number " Constant
224 HiLink vmasmbinNumber Number " Constant
225 HiLink vmasmdecNumber Number " Constant
226 HiLink vmasmfloatNumber Number " Constant
228 " HiLink vmasmString String " Constant
230 HiLink vmasmReg Identifier
231 HiLink vmasmOperator Identifier
233 HiLink vmasmInclude Include " PreProc
234 HiLink vmasmMacro Macro " PreProc
235 " HiLink vmasmMacroParam Keyword " Statement
237 HiLink vmasmDirective Special
238 HiLink vmasmPreCond Special
241 HiLink vmasmOpcode Statement
242 HiLink vmasmCond Conditional " Statement
243 HiLink vmasmRepeat Repeat " Statement
245 HiLink vmasmLabel Type
249 let b:current_syntax = "vmasm"