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