if exists("b:current_syntax")
finish
endif
syn case match
syn region cspComment	start="{-"  end="-}" contains=cspTodo
syn region cspComment	start="--"  end="$" contains=cspTodo,cspOldRttComment,cspSdlRttComment keepend
syn match  cspNumber "\<\d\+\>"
syn keyword  cspConditional if then else
syn match  cspOperator "->"
syn match  cspOperator "/\\"
syn match  cspOperator "[^/]\\"lc=1
syn match  cspOperator "\[\]"
syn match  cspOperator "|\~|"
syn match  cspOperator "\[>"
syn match  cspOperator "\[\["
syn match  cspOperator "\]\]"
syn match  cspOperator "<-"
syn match  cspOperator "|||"
syn match  cspOperator "[^|]||[^|]"lc=1,me=e-1
syn match  cspOperator "[^|{\~]|[^|}\~]"lc=1,me=e-1
syn match  cspOperator "\[|"
syn match  cspOperator "|\]"
syn match  cspOperator "\[[^>]"me=e-1
syn match  cspOperator "\]"
syn match  cspOperator "<->"
syn match  cspOperator "[?:!';@]"
syn match  cspOperator "&"
syn match  cspOperator "\."
syn keyword cspKeyword		length null head tail concat elem
syn keyword cspKeyword		union inter diff Union Inter member card
syn keyword cspKeyword		empty set Set Seq
syn keyword cspKeyword		true false and or not within let
syn keyword cspKeyword		nametype datatype diamond normal
syn keyword cspKeyword		sbisim tau_loop_factor model_compress
syn keyword cspKeyword		explicate
syn match cspKeyword		"transparent"
syn keyword cspKeyword		external chase prioritize
syn keyword cspKeyword		channel Events
syn keyword cspKeyword		extensions productions
syn keyword cspKeyword		Bool Int
syn keyword cspReserved		attribute embed module subtype
syn region cspInclude matchgroup=cspIncludeKeyword start="^include" end="$" keepend contains=cspIncludeArg
syn region cspIncludeArg start='\s\+\"' end= '\"\s*' contained
syn keyword cspAssert		assert deterministic divergence free deadlock
syn keyword cspAssert		livelock
syn match cspAssert		"\[T="
syn match cspAssert		"\[F="
syn match cspAssert		"\[FD="
syn match cspAssert		"\[FD\]"
syn match cspAssert		"\[F\]"
syn match cspType     "\<_*[A-Z][A-Z_0-9]*[a-z]\(\|[A-Za-z_0-9]*[A-Za-z0-9]\)\>"
syn match cspProcess		"\<[A-Z_][A-Z_0-9]*[A-Z0-9]\>"
syn match cspProcess		"\<[A-Z_]\>"
syn match cspReservedIdentifier	"\<[A-Za-z_][A-Za-z_0-9]*_\>"
syn match cspTodo		"FIXME"	contained
syn match cspTodo		"TODO"	contained
syn match cspTodo		"!!!"	contained
syn match cspOldRttComment	"^--\$\$AM_UNDEF"lc=2		contained
syn match cspOldRttComment	"^--\$\$AM_ERROR"lc=2		contained
syn match cspOldRttComment	"^--\$\$AM_WARNING"lc=2		contained
syn match cspOldRttComment	"^--\$\$AM_SET_TIMER"lc=2	contained
syn match cspOldRttComment	"^--\$\$AM_RESET_TIMER"lc=2	contained
syn match cspOldRttComment	"^--\$\$AM_ELAPSED_TIMER"lc=2	contained
syn match cspOldRttComment	"^--\$\$AM_OUTPUT"lc=2		contained
syn match cspOldRttComment	"^--\$\$AM_INPUT"lc=2		contained
syn region cspRttPragma matchgroup=cspRttPragmaKeyword start="^pragma\s\+" end="\s*$" oneline keepend contains=cspRttPragmaArg,cspRttPragmaSdl
syn keyword cspRttPragmaArg	AM_ERROR AM_WARNING AM_SET_TIMER contained
syn keyword cspRttPragmaArg	AM_RESET_TIMER AM_ELAPSED_TIMER  contained
syn keyword cspRttPragmaArg	AM_OUTPUT AM_INPUT AM_INTERNAL   contained
syn region cspRttPragmaSdl	matchgroup=cspRttPragmaKeyword start="SDL_MATCH\s\+" end="\s*$" contains=cspRttPragmaSdlArg contained
syn keyword cspRttPragmaSdlArg	TRANSLATE nextgroup=cspRttPragmaSdlTransName contained
syn keyword cspRttPragmaSdlArg	PARAM SKIP OPTIONAL CHOICE ARRAY nextgroup=cspRttPragmaSdlName contained
syn match cspRttPragmaSdlName	"\s*\S\+\s*" nextgroup=cspRttPragmaSdlTail contained
syn region cspRttPragmaSdlTail  start="" end="\s*$" contains=cspRttPragmaSdlTailArg contained
syn keyword cspRttPragmaSdlTailArg	SUBSET_USED DEFAULT_VALUE Present contained
syn match cspRttPragmaSdlTransName	"\s*\w\+\s*" nextgroup=cspRttPragmaSdlTransTail contained
syn region cspRttPragmaSdlTransTail  start="" end="\s*$" contains=cspRttPragmaSdlTransTailArg contained
syn keyword cspRttPragmaSdlTransTailArg	sizeof contained
syn match cspRttPragmaSdlTransTailArg	"\*" contained
syn match cspRttPragmaSdlTransTailArg	"(" contained
syn match cspRttPragmaSdlTransTailArg	")" contained
syn match cspSdlRttComment	"pragma\s\+SDL_MATCH\s\+" nextgroup=cspRttPragmaSdlArg contained
syn sync lines=250
hi def link cspComment			Comment
hi def link cspNumber			Number
hi def link cspConditional			Conditional
hi def link cspOperator			Delimiter
hi def link cspKeyword			Keyword
hi def link cspReserved			SpecialChar
hi def link cspInclude			Error
hi def link cspIncludeKeyword		Include
hi def link cspIncludeArg			Include
hi def link cspAssert			PreCondit
hi def link cspType			Type
hi def link cspProcess			Function
hi def link cspTodo			Todo
hi def link cspOldRttComment		Define
hi def link cspRttPragmaKeyword		Define
hi def link cspSdlRttComment		Define
hi def link cspRttPragmaArg		Define
hi def link cspRttPragmaSdlArg		Define
hi def link cspRttPragmaSdlName		Default
hi def link cspRttPragmaSdlTailArg		Define
hi def link cspRttPragmaSdlTransName	Default
hi def link cspRttPragmaSdlTransTailArg	Define
hi def link cspReservedIdentifier	Error
let b:current_syntax = "csp"
