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