7
|
1 " Vim syntax file
|
|
2 " Language: Microsoft Assembler (80x86)
|
|
3 " Maintainer: Rob Brady <robb@datatone.com>
|
|
4 " Last Change: $Date$
|
|
5 " URL: http://www.datatone.com/~robb/vim/syntax/masm.vim
|
|
6 " $Revision$
|
|
7
|
|
8 " For version 5.x: Clear all syntax items
|
|
9 " For version 6.x: Quit when a syntax file was already loaded
|
|
10 if version < 600
|
|
11 syntax clear
|
|
12 elseif exists("b:current_syntax")
|
|
13 finish
|
|
14 endif
|
|
15
|
|
16 syn case ignore
|
|
17
|
|
18
|
|
19 " syn match masmType "\.word"
|
|
20
|
|
21 syn match masmIdentifier "[a-z_$][a-z0-9_$]*"
|
|
22 syn match masmLabel "^[A-Z_$][A-Z0-9_$]*:"he=e-1
|
|
23
|
|
24 syn match masmDecimal "\d*"
|
|
25 syn match masmBinary "[0-1]\+b" "put this before hex or 0bfh dies!
|
|
26 syn match masmHexadecimal "[0-9]\x*h"
|
|
27 syn match masmFloat "[0-9]\x*r"
|
|
28
|
|
29 syn match masmComment ";.*"
|
|
30 syn region masmString start=+'+ end=+'+
|
|
31
|
|
32 syn keyword masmOperator AND BYTE PTR CODEPTR DATAPTR DUP DWORD EQ FAR
|
|
33 syn keyword masmOperator FWORD GE GT HIGH LARGE LE LOW LT MOD NE NEAR
|
|
34 syn keyword masmOperator NOT OFFSET OR PROC PWORD QWORD SEG SHORT TBYTE
|
|
35 syn keyword masmOperator TYPE WORD PARA
|
|
36 syn keyword masmDirective ALIGN ARG ASSUME CODESEG COMM
|
|
37 syn keyword masmDirective CONST DATASEG DB DD DF DISPLAY DOSSEG DP
|
|
38 syn keyword masmDirective DQ DT DW ELSE ELSEIF EMUL END ENDIF ENDM ENDP
|
|
39 syn keyword masmDirective ENDS ENUM EQU PROC PUBLIC PUBLICDLL RADIX
|
|
40 syn keyword masmDirective EXTRN FARDATA GLOBAL RECORD SEGMENT SMALLSTACK
|
|
41 syn keyword masmDirective GROUP IF IF1 IF2 IFB IFDEF IFDIF IFDIFI
|
|
42 syn keyword masmDirective IFE IFIDN IFIDNI IFNB IFNDEF INCLUDE INCLUDLIB
|
|
43 syn keyword masmDirective LABEL LARGESTACK STACK STRUC SUBTTL TITLE
|
|
44 syn keyword masmDirective MODEL NAME NOEMUL UNION USES VERSION
|
|
45 syn keyword masmDirective ORG FLAT
|
|
46 syn match masmDirective "\.model"
|
|
47 syn match masmDirective "\.186"
|
|
48 syn match masmDirective "\.286"
|
|
49 syn match masmDirective "\.286c"
|
|
50 syn match masmDirective "\.286p"
|
|
51 syn match masmDirective "\.287"
|
|
52 syn match masmDirective "\.386"
|
|
53 syn match masmDirective "\.386c"
|
|
54 syn match masmDirective "\.386p"
|
|
55 syn match masmDirective "\.387"
|
|
56 syn match masmDirective "\.486"
|
|
57 syn match masmDirective "\.486c"
|
|
58 syn match masmDirective "\.486p"
|
|
59 syn match masmDirective "\.8086"
|
|
60 syn match masmDirective "\.8087"
|
|
61 syn match masmDirective "\.ALPHA"
|
|
62 syn match masmDirective "\.CODE"
|
|
63 syn match masmDirective "\.DATA"
|
|
64
|
|
65 syn keyword masmRegister AX BX CX DX SI DI BP SP
|
|
66 syn keyword masmRegister ES DS SS CS
|
|
67 syn keyword masmRegister AH BH CH DH AL BL CL DL
|
|
68 syn keyword masmRegister EAX EBX ECX EDX ESI EDI EBP ESP
|
|
69
|
|
70
|
|
71 " these are current as of the 486 - don't have any pentium manuals handy
|
|
72 syn keyword masmOpcode AAA AAD AAM AAS ADC ADD AND ARPL BOUND BSF
|
|
73 syn keyword masmOpcode BSR BSWAP BT BTC BTR BTS BSWAP BT BTC BTR
|
|
74 syn keyword masmOpcode BTS CALL CBW CDQ CLC CLD CLI CLTS CMC CMP
|
|
75 syn keyword masmOpcode CMPS CMPSB CMPSW CMPSD CMPXCHG CWD CWDE DAA
|
|
76 syn keyword masmOpcode DAS DEC DIV ENTER HLT IDIV IMUL IN INC INS
|
|
77 syn keyword masmOpcode INSB INSW INSD INT INTO INVD INVLPG IRET
|
|
78 syn keyword masmOpcode IRETD JA JAE JB JBE JC JCXZ JECXZ JE JZ JG
|
|
79 syn keyword masmOpcode JGE JL JLE JNA JNAE JNB JNBE JNC JNE JNG JNGE
|
|
80 syn keyword masmOpcode JNL JNLE JNO JNP JNS JNZ JO JP JPE JPO JS JZ
|
|
81 syn keyword masmOpcode JMP LAHF LAR LEA LEAVE LGDT LIDT LGS LSS LFS
|
|
82 syn keyword masmOpcode LODS LODSB LODSW LODSD LOOP LOOPE LOOPZ LOONE
|
|
83 syn keyword masmOpcode LOOPNE RETF RETN
|
|
84 syn keyword masmOpcode LDS LES LLDT LMSW LOCK LSL LTR MOV MOVS MOVSB
|
|
85 syn keyword masmOpcode MOVSW MOVSD MOVSX MOVZX MUL NEG NOP NOT OR
|
|
86 syn keyword masmOpcode OUT OUTS OUTSB OUTSW OUTSD POP POPA POPD
|
|
87 syn keyword masmOpcode POPF POPFD PUSH PUSHA PUSHAD PUSHF PUSHFD
|
|
88 syn keyword masmOpcode RCL RCR ROL ROR REP REPE REPZ REPNE REPNZ
|
|
89 syn keyword masmOpcode RET SAHF SAL SAR SHL SHR SBB SCAS SCASB
|
|
90 syn keyword masmOpcode SCASW SCASD SETA SETAE SETB SETBE SETC SETE
|
|
91 syn keyword masmOpcode SETG SETGE SETL SETLE SETNA SETNAE SETNB
|
|
92 syn keyword masmOpcode SETNBE SETNC SETNE SETNG SETNGE SETNL SETNLE
|
|
93 syn keyword masmOpcode SETNO SETNP SETNS SETNZ SETO SETP SETPE SETPO
|
|
94 syn keyword masmOpcode SETS SETZ SGDT SIDT SHLD SHRD SLDT SMSW STC
|
|
95 syn keyword masmOpcode STD STI STOS STOSB STOSW STOSD STR SUB TEST
|
|
96 syn keyword masmOpcode VERR VERW WAIT WBINVD XADD XCHG XLAT XLATB XOR
|
|
97
|
|
98 " floating point coprocessor as of 487
|
|
99 syn keyword masmOpFloat F2XM1 FABS FADD FADDP FBLD FBSTP FCHS FCLEX
|
|
100 syn keyword masmOpFloat FNCLEX FCOM FCOMP FCOMPP FCOS FDECSTP FDISI
|
|
101 syn keyword masmOpFloat FNDISI FDIV FDIVP FDIVR FDIVRP FENI FNENI
|
|
102 syn keyword masmOpFloat FFREE FIADD FICOM FICOMP FIDIV FIDIVR FILD
|
|
103 syn keyword masmOpFloat FIMUL FINCSTP FINIT FNINIT FIST FISTP FISUB
|
|
104 syn keyword masmOpFloat FISUBR FLD FLDCW FLDENV FLDLG2 FLDLN2 FLDL2E
|
|
105 syn keyword masmOpFloat FLDL2T FLDPI FLDZ FLD1 FMUL FMULP FNOP FPATAN
|
|
106 syn keyword masmOpFloat FPREM FPREM1 FPTAN FRNDINT FRSTOR FSAVE
|
|
107 syn keyword masmOpFloat FNSAVE FSCALE FSETPM FSIN FSINCOS FSQRT FST
|
|
108 syn keyword masmOpFloat FSTCW FNSTCW FSTENV FNSTENV FSTP FSTSW FNSTSW
|
|
109 syn keyword masmOpFloat FSUB FSUBP FSUBR FSUBRP FTST FUCOM FUCOMP
|
|
110 syn keyword masmOpFloat FUCOMPP FWAIT FXAM FXCH FXTRACT FYL2X FYL2XP1
|
|
111 syn match masmOpFloat "FSTSW[ \t]\+AX"
|
|
112 syn match masmOpFloat "FNSTSW[ \t]\+AX"
|
|
113
|
|
114 " Define the default highlighting.
|
|
115 " For version 5.7 and earlier: only when not done already
|
|
116 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
117 if version >= 508 || !exists("did_masm_syntax_inits")
|
|
118 if version < 508
|
|
119 let did_masm_syntax_inits = 1
|
|
120 command -nargs=+ HiLink hi link <args>
|
|
121 else
|
|
122 command -nargs=+ HiLink hi def link <args>
|
|
123 endif
|
|
124
|
|
125 " The default methods for highlighting. Can be overridden later
|
|
126 HiLink masmLabel Label
|
|
127 HiLink masmComment Comment
|
|
128 HiLink masmDirective Statement
|
|
129 HiLink masmOperator Statement
|
|
130 HiLink masmString String
|
|
131
|
|
132 HiLink masmHexadecimal Number
|
|
133 HiLink masmDecimal Number
|
|
134 HiLink masmBinary Number
|
|
135 HiLink masmFloat Number
|
|
136
|
|
137 HiLink masmIdentifier Identifier
|
|
138
|
|
139 delcommand HiLink
|
|
140 endif
|
|
141
|
|
142 let b:current_syntax = "masm"
|
|
143
|
|
144 " vim: ts=8
|