" Vim syntax file " Language: GNU Assembler " Maintainer: Kevin Dahlhausen " Last Change: 1999 Jun 14 " Remove any old syntax stuff hanging around syn clear syn case ignore " storage types syn match asmType "\.long" syn match asmType "\.ascii" syn match asmType "\.asciz" syn match asmType "\.byte" syn match asmType "\.double" syn match asmType "\.float" syn match asmType "\.hword" syn match asmType "\.int" syn match asmType "\.octa" syn match asmType "\.quad" syn match asmType "\.short" syn match asmType "\.single" syn match asmType "\.space" syn match asmType "\.string" syn match asmType "\.word" syn match asmLabel "[a-z_][a-z0-9_]*:"he=e-1 syn match asmReg "\%[a-zA_Z0-9]*" syn match asmIdentifier "[a-z_][a-z0-9_]*" syn match asmConstant "\$[a-zA-Z0-9_]*" " Various #'s as defined by GAS ref manual sec 3.6.2.1 " Technically, the first decNumber def is actually octal, " since the value of 0-7 octal is the same as 0-7 decimal, " I prefer to map it as decimal: syn match decNumber "0\+[1-7]\=[\t\n$,; ]" syn match decNumber "[1-9]\d*" syn match octNumber "0[0-7][0-7]\+" syn match hexNumber "0[xX][0-9a-fA-F]\+" syn match binNumber "0[bB][0-1]*" syn match asmSpecialComment ";\*\*\*.*" syn match asmComment "/*"hs=s+1 syn match asmInclude "\.include" syn match asmCond "\.if" syn match asmCond "\.else" syn match asmCond "\.endif" syn match asmMacro "\.macro" syn match asmMacro "\.endm" syn match asmDirective "\.[a-z][a-z]\+" " the following is copy 'n pasted from c.vim syn keyword cTodo contained TODO FIXME XXX " cCommentGroup allows adding matches for special things in comments syn cluster cCommentGroup contains=cTodo " String and Character constants " Highlight special characters (those which have a backslash) differently syn match cSpecial contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" if !exists("c_no_utf") syn match cSpecial contained "\\\(u\x\{4}\|U\x\{8}\)" endif if exists("c_no_cformat") syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial else syn match cFormat "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained syn match cFormat "%%" contained syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat hi link cFormat cSpecial endif hi link cCppString cString syn match cCharacter "L\='[^\\]'" syn match cCharacter "L'[^']*'" contains=cSpecial syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'" syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'" syn match cSpecialCharacter "L\='\\\o\{1,3}'" syn match cSpecialCharacter "'\\x\x\{1,2}'" syn match cSpecialCharacter "L'\\x\x\+'" syn match cCommentSkip contained "^\s*\*\($\|\s\+\)" syn region cCommentString contained start=+L\="+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip syn region cComment2String contained start=+L\="+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError syn region cComment start="/\*" end="\*/" contains=@cCommentGroup,cCommentString,cCharacter,cNumbersCom,cSpaceError syn case match if !exists("did_asm_syntax_inits") let did_asm_syntax_inits = 1 " The default methods for highlighting. Can be overridden later hi link asmSection Special hi link asmLabel Label hi link asmComment Comment hi link asmDirective Statement hi link asmInclude Include hi link asmCond PreCondit hi link asmMacro Macro hi link hexNumber Number hi link decNumber Number hi link octNumber Number hi link binNumber Number " My default color overrides: hi asmSpecialComment ctermfg=red hi asmIdentifier ctermfg=black hi asmReg ctermfg=blue hi asmType ctermfg=brown hi asmConstant ctermfg=darkred hi cComment ctermfg=darkcyan hi cCommentString ctermfg=darkred endif let b:current_syntax = "asms"