vmasm.vim 8.3 KB

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