JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
don't stop on foldmethod of other buffers
[vim-syntax.git] / asm.vim
1 if version < 600
2   syntax clear
3 elseif exists("b:current_syntax")
4   finish
5 endif
6
7 syn match asmDirective          "\W\.[a-z][a-z]\+\>"
8
9
10 " storage types
11 syn match asmType "\W\.long"
12 syn match asmType "\W\.ascii"
13 syn match asmType "\W\.asciz"
14 syn match asmType "\W\.byte"
15 syn match asmType "\W\.double"
16 syn match asmType "\W\.float"
17 syn match asmType "\W\.hword"
18 syn match asmType "\W\.int"
19 syn match asmType "\W\.octa"
20 syn match asmType "\W\.quad"
21 syn match asmType "\W\.short"
22 syn match asmType "\W\.single"
23 syn match asmType "\W\.space"
24 syn match asmType "\W\.string"
25 syn match asmType "\W\.word"
26
27
28 syn match decNumber             "\<[1-9]\d*\>"
29 syn match octNumber             "\<0[0-7]*\>"
30 syn match hexNumber             "\<0[x][0-9a-f]*\>"
31 syn match binNumber             "\<0[b][0-1]*\>"
32
33 syn match asmLabel      "^[a-z0-9_]*:"he=e-1
34 syn match asmIdentifier "^\s\+[a-z_][a-z0-9_]*"
35 syn match asmIdentifier "^[0-9]:\s\+[a-z_][a-z0-9_]*"lc=2
36
37 syn match asmComment            "#.*"hs=s+1
38
39 syn match asmInclude            "\W\.include"
40 syn match asmCond               "\W\.if\>"
41 syn match asmCond               "\W\.else\>"
42 syn match asmCond               "\W\.elseif"
43 syn match asmCond               "\W\.endif"
44 syn match asmMacro              "\W\.macro"
45 syn match asmMacro              "\W\.endm"
46
47
48 syn case match
49
50 " Define the default highlighting.
51 " For version 5.7 and earlier: only when not done already
52 " For version 5.8 and later: only when an item doesn't have highlighting yet
53 if version >= 508 || !exists("did_asm_syntax_inits")
54   if version < 508
55     let did_asm_syntax_inits = 1
56     command -nargs=+ HiLink hi link <args>
57   else
58     command -nargs=+ HiLink hi def link <args>
59   endif
60
61   " The default methods for highlighting.  Can be overridden later
62   HiLink asmSection     Special
63   HiLink asmLabel       Label
64   HiLink asmComment     Comment
65   HiLink asmDirective   Statement
66
67   HiLink asmInclude     Include
68   HiLink asmCond        PreCondit
69   HiLink asmMacro       Macro
70
71   HiLink hexNumber      Number
72   HiLink decNumber      Number
73   HiLink octNumber      Number
74   HiLink binNumber      Number
75
76   HiLink asmSpecialComment Comment
77   HiLink asmIdentifier Identifier
78   HiLink asmType        Type
79
80   hi asmComment ctermfg=red
81
82   delcommand HiLink
83 endif
84
85 let b:current_syntax = "asm"
86
87 " vim: ts=8