" Vim syntax file
" Language:	Matlab
" Maintainer:	Mario Eusebio <bio@dq.fct.unl.pt>
" Last change:	1997 April 25

" Remove any old syntax stuff hanging around
syntax clear

syntax case match

syntax keyword matlabStatement		continue return 
syntax keyword matlabLabel		case switch
syntax keyword matlabConditional	else elseif end if 
syntax keyword matlabRepeat		do for while

syntax keyword matlabTodo contained	TODO

" String 
syntax region  matlabString	  start=+'+  end=+'+

" Doesn't handle a'' but of course a''=a
syntax match  matlabTransposeOperator	"[a-zA-Z0-9).]'"s+1
syntax match  matlabTransposeMatrix	"]'"

" If you choose matlabDelimiter then uncomment next commands
"syntax match  matlabTransposeOperator	"[a-zA-Z0-9.]'"s+1
"syntax match  matlabTransposeMatrix	")'"
"syntax match  matlabTransposeMatrix	"]'"

"syntax match  matlabIdentifier	"\<[a-zA-Z_][a-zA-Z0-9_]*\>"

"syntax match  matlabDelimiter	"[()]"
syntax match  matlabMatrixDelimiter	"[][]"

" I don't like MatlabPoint* form of numbers
syntax match  matlabNumber		"-\=\<[0-9]\+\.[0-9]\+[dD]-\=[0-9]\+\>"
"syntax match  matlabPointNumber	"-\=\<[0-9]\+\.[dD]-\=[0-9]\+\>"
"syntax match  matlabPointNumber	"-\=\.[0-9]\+[dD]-\=[0-9]\+\>"
"syntax match  matlabPointNumber	"-\=[0-9]\+[dD]-\=[0-9]\+\>"
syntax match  matlabNumber		"-\=\<[0-9]\+\.[0-9]\+[eE]-\=[0-9]\+\>"
"syntax match  matlabPointNumber	"-\=\<[0-9]\+\.[eE]-\=[0-9]\+\>"
"syntax match  matlabPointNumber	"-\=\.[0-9]\+[eE]-\=[0-9]\+\>"
"syntax match  matlabPointNumber	"-\=[0-9]\+[eE]-\=[0-9]\+\>"
syntax match  matlabNumber		"-\=\<[0-9]\+\.[0-9]\+\>"
"syntax match  matlabPointNumber	"-\=\<[0-9]\+\."
"syntax match  matlabPointNumber	"-\=\.[0-9]\+\>"
syntax match  matlabNumber		"-\=\<[0-9]\+\>"

" If you don't like tabs
"syntax match matlabShowTab "\t"
"syntax match matlabShowTabc "\t"

" syntax match  matlabComment		"%.*$" contains matlabTodo matlabShowTabc
syntax match  matlabComment		"%.*$" contains matlabTodo

syntax keyword matlabOperator		break zeros default margin round
syntax keyword matlabOperator		ceil floor size clear

syntax keyword matlabFunction		eval function

syntax keyword matlabError		error

syntax keyword matlabImplicit		abs acos atan asin cos cosh
syntax keyword matlabImplicit		exp log log10 max min 
syntax keyword matlabImplicit		sign sqrt tan 

if !exists("did_matlab_syntax_inits")
  let did_matlab_syntax_inits = 1
  " The default methods for highlighting.  Can be overridden later
  highlight link matlabLabel			Label
  highlight link matlabConditional		Conditional
  highlight link matlabRepeat			Repeat
  highlight link matlabTodo			Todo
  highlight link matlabString			String
  highlight link matlabTransposeOperator	Operator 
  highlight link matlabMatrixDelimiter		Identifier
  highlight link matlabTransposeMatrix		Identifier
  highlight link matlabNumber			Number
  highlight link matlabOperator			Operator
  highlight link matlabFunction			Function
  highlight link matlabError			Error
  highlight link matlabImplicit			matlabStatement
  highlight link matlabComment			Comment
  highlight link matlabStatement		Statement

"optional highlighting
  "highlight link matlabDelimiter		Identifier
  "highlight link matlabPointNumber		Number

  "highlight link matlabShowTab			Error
  "highlight link matlabShowTabc		Error

  "highlight link matlabIdentifier		Identifier
endif
