" Vim syntax file
" Language:	GNU Assembler
" Maintainer:	Kevin Dahlhausen <ap096@po.cwru.edu>
" Last change:	1997 April 20

" Remove any old syntax stuff hanging around
syntax clear

syntax case ignore


" storage types
syntax match asmType "\.long"
syntax match asmType "\.ascii"
syntax match asmType "\.asciz"
syntax match asmType "\.byte"
syntax match asmType "\.double"
syntax match asmType "\.float"
syntax match asmType "\.hword"
syntax match asmType "\.int"
syntax match asmType "\.octa"
syntax match asmType "\.quad"
syntax match asmType "\.short"
syntax match asmType "\.single"
syntax match asmType "\.space"
syntax match asmType "\.string"
syntax match asmType "\.word"

syntax match  asmLabel	"[a-z_][a-z0-9_]*:"e-1
syntax match  asmIdentifier 	"[a-z_][a-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:
syntax match  decNumber     "0\+[1-7]\=[\t\n$,; ]"
syntax match  decNumber     "[1-9][0-9]*"
syntax match  octNumber  	"0[0-7][0-7]\+"
syntax match  hexNumber		"0[xX][0-9a-fA-F]\+"
syntax match  binNumber  	"0[bB][0-1]*"


syntax match  asmSpecialComment ";\*\*\*.*"
syntax match  asmComment ";.*"s+1

syntax match asmInclude		"\.include"
syntax match asmCond		"\.if"
syntax match asmCond		"\.else"
syntax match asmCond		"\.endif"
syntax match asmMacro		"\.macro"
syntax match asmMacro		"\.endm"

syntax match asmDirective	"\.[a-z][a-z]\+"


syntax case match

if !exists("did_asm_syntax_inits")
  let did_asm_syntax_inits = 1

  " The default methods for highlighting.  Can be overridden later
  highlight link asmSection	Special
  highlight link asmLabel	Label
  highlight link asmComment	Comment
  highlight link asmDirective Statement

  highlight link asmInclude	Include
  highlight link asmCond	PreCondit
  highlight link asmMacro	Macro

  highlight link hexNumber	Number
  highlight link decNumber	Number
  highlight link octNumber	Number
  highlight link binNumber	Number

  " My default color overrides:
  highlight asmSpecialComment ctermfg=red
  highlight asmIdentifier ctermfg=lightcyan
  highlight asmType ctermbg=black ctermfg=brown

endif
