neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

mix.vim (2942B)


      1 " Vim syntax file
      2 " Language:	MIX (Donald Knuth's assembly language used in TAOCP)
      3 " Maintainer:	Wu Yongwei <wuyongwei@gmail.com>
      4 " Filenames:	*.mixal *.mix
      5 " Last Change:  2017-11-26 15:21:36 +0800
      6 
      7 " Quit when a syntax file was already loaded
      8 if exists("b:current_syntax")
      9  finish
     10 endif
     11 
     12 let s:cpo_save = &cpo
     13 set cpo&vim
     14 
     15 syn case ignore
     16 
     17 " Special processing of ALF directive: implementations vary whether quotation
     18 " marks are needed
     19 syn match mixAlfParam		#\s\{1,2\}"\?[^"]\{,5\}"\?# contains=mixString nextgroup=mixEndComment contained
     20 
     21 " Region for parameters
     22 syn match mixParam		#[-+*/:=0-9a-z,()"]\+# contains=mixIdentifier,mixSpecial,mixNumber,mixString,mixLabel nextgroup=mixEndComment contained
     23 
     24 " Comment at the line end
     25 syn match mixEndComment		".*" contains=mixRegister contained
     26 
     27 " Identifier; must go before literals
     28 syn match mixIdentifier		"[a-z0-9_]\+" contained
     29 
     30 " Literals
     31 syn match mixSpecial		"[-+*/:=]" contained
     32 syn match mixNumber		"[0-9]\+\>" contained
     33 syn region mixString		start=+"+ skip=+\\"+ end=+"+ contained
     34 
     35 " Labels
     36 syn match mixLabel		"^[a-z0-9_]\{,10\}\s\+" nextgroup=mixAlfSpecial,mixOpcode,mixDirective
     37 syn match mixLabel		"[0-9][BF]" contained
     38 
     39 " Comments
     40 syn match mixComment		"^\*.*" contains=mixRegister
     41 
     42 " Directives
     43 syn keyword mixDirective 	ORIG EQU CON END nextgroup=mixParam contained skipwhite
     44 syn keyword mixDirective 	ALF nextgroup=mixAlfParam contained
     45 
     46 " Opcodes
     47 syn keyword mixOpcode	NOP HLT NUM CHAR FLOT FIX nextgroup=mixEndComment contained
     48 syn keyword mixOpcode	FADD FSUB FMUL FDIV FCMP MOVE ADD SUB MUL DIV IOC IN OUT JRED JBUS JMP JSJ JOV JNOV JL JE JG JLE JNE JGE SLA SRA SLAX SRAX SLC SRC nextgroup=mixParam contained skipwhite
     49 syn keyword mixOpcode	SLB SRB JAE JAO JXE JXO nextgroup=mixParam contained skipwhite
     50 
     51 syn match mixOpcode	"LD[AX1-6]N\?\>" nextgroup=mixParam contained skipwhite
     52 syn match mixOpcode	"ST[AX1-6JZ]\>" nextgroup=mixParam contained skipwhite
     53 syn match mixOpcode	"EN[TN][AX1-6]\>" nextgroup=mixParam contained skipwhite
     54 syn match mixOpcode	"INC[AX1-6]\>" nextgroup=mixParam contained skipwhite
     55 syn match mixOpcode	"DEC[AX1-6]\>" nextgroup=mixParam contained skipwhite
     56 syn match mixOpcode	"CMP[AX1-6]\>" nextgroup=mixParam contained skipwhite
     57 syn match mixOpcode	"J[AX1-6]N\?[NZP]\>" nextgroup=mixParam contained skipwhite
     58 
     59 " Switch back to being case sensitive
     60 syn case match
     61 
     62 " Registers (only to be used in comments now)
     63 syn keyword mixRegister	rA rX rI1 rI2 rI3 rI4 rI5 rI6 rJ contained
     64 
     65 " The default highlighting
     66 hi def link mixRegister		Special
     67 hi def link mixLabel		Define
     68 hi def link mixComment		Comment
     69 hi def link mixEndComment	Comment
     70 hi def link mixDirective	Keyword
     71 hi def link mixOpcode		Keyword
     72 
     73 hi def link mixSpecial		Special
     74 hi def link mixNumber		Number
     75 hi def link mixString		String
     76 hi def link mixAlfParam		String
     77 hi def link mixIdentifier	Identifier
     78 
     79 let b:current_syntax = "mix"
     80 
     81 let &cpo = s:cpo_save
     82 unlet s:cpo_save
     83 
     84 " vim: ts=8