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