" Vim syntax file
" Language:	Century Term Command Script
" Maintainer:	Sean M. McKee <mckee@misslink.net>
" Last change:	5/5/97 - 09:17:02
" Version Info: @(#)cterm.vim	1.6	97/05/05 09:17:02

syntax clear

syntax case ignore

"FUNCTIONS
syntax keyword CTermFunction	abort addcr addlf answer at attr batch baud
syntax keyword CTermFunction	break call capture cd cdelay charset cls color
syntax keyword CTermFunction	combase config commect copy cread
syntax keyword CTermFunction	creadint devprefix dialer dialog dimint
syntax keyword CTermFunction	dimlog dimstr display dtimeout dwait edit
syntax keyword CTermFunction	editor emulate erase escloop fcreate
syntax keyword CTermFunction	fflush fillchar flags flush fopen fread
syntax keyword CTermFunction	freadln fseek fwrite fwriteln get hangup
syntax keyword CTermFunction	help hiwait htime ignore init itime
syntax keyword CTermFunction	keyboard lchar ldelay learn lockfile 
syntax keyword CTermFunction	locktime log login logout lowait
syntax keyword CTermFunction	lsend ltime memlist menu mkdir mode 
syntax keyword CTermFunction	modem netdialog netport noerror pages parity
syntax keyword CTermFunction	pause portlist printer protocol quit rcv
syntax keyword CTermFunction	read readint readn redial release
syntax keyword CTermFunction	remote rename restart retries return 
syntax keyword CTermFunction	rmdir rtime run runx scrollback send
syntax keyword CTermFunction	session set setcap setcolor setkey 
syntax keyword CTermFunction	setsym setvar startserver status
syntax keyword CTermFunction	stime stopbits stopserver tdelay
syntax keyword CTermFunction	terminal time trans type usend version
syntax keyword CTermFunction	vi vidblink vidcard vidout vidunder wait
syntax keyword CTermFunction	wildsize wclose wopen wordlen wru wruchar 
syntax keyword CTermFunction	xfer xmit xprot
syntax match CTermFunction		"\?"
"syntax keyword CTermFunction	comment remark

"END FUNCTIONS
"INTEGER FUNCTIONS
syntax keyword CTermIntFunction	asc atod eval filedate filemode filesize ftell
syntax keyword CTermIntFunction	len termbits opsys pos sum time val mdmstat
"END INTEGER FUNCTIONS

"STRING FUNCTIONS
syntax keyword CTermStrFunction	cdate ctime chr chrdy chrin comin getenv
syntax keyword CTermStrFunction	gethomedir left midstr right str tolower
syntax keyword CTermStrFunction	toupper uniq comst exists feof hascolor

"END STRING FUNCTIONS

"PREDEFINED TERM VARIABLES R/W
syntax keyword CTermPreVarRW	f _escloop _filename _kermiteol _obufsiz
syntax keyword CTermPreVarRW	_port _rcvsync _cbaud _reval _turnchar
syntax keyword CTermPreVarRW	_txblksiz _txwindow _vmin _vtime _cparity
syntax keyword CTermPreVarRW	_cnumber false t true _cwordlen _cstopbits
syntax keyword CTermPreVarRW	_cmode _cemulate _cxprot _clogin _clogout
syntax keyword CTermPreVarRW	_cstartsrv _cstopsrv _ccmdfile _cwru
syntax keyword CTermPreVarRW	_cprotocol _captfile _cremark _combufsiz
syntax keyword CTermPreVarRW	logfile
"END PREDEFINED TERM VARIABLES R/W

"PREDEFINED TERM VARIABLES R/O
syntax keyword CTermPreVarRO	_1 _2 _3 _4 _5 _6 _7 _8 _9 _cursess
syntax keyword CTermPreVarRO	_lockfile _baud _errno _retval _sernum
syntax keyword CTermPreVarRO	_timeout _row _col _version
"END PREDEFINED TERM VARIABLES R/O

syntax keyword CTermOperator not mod eq ne gt le lt ge xor and or shr not shl

"SYMBOLS
syntax match   CtermSymbols         "|"
"syntax keyword CTermOperators + - * / % = != > < >= <= & | ^ ! << >>
"END SYMBOLS

"STATEMENT
syntax keyword CTermStatement	off 
syntax keyword CTermStatement	disk overwrite append spool none
syntax keyword CTermStatement	echo view wrap
"END STATEMENT

"TYPE
"syntax keyword CTermType
"END TYPE

"USERLIB FUNCTIONS
"syntax keyword CTermLibFunc 
"END USERLIB FUNCTIONS

"LABEL
syntax keyword CTermLabel    case default
"END LABEL

"CONDITIONAL
syntax keyword CTermConditional on endon
syntax keyword CTermConditional proc endproc
syntax keyword CTermConditional for in do endfor
syntax keyword CTermConditional if else elseif endif iferror
syntax keyword CTermConditional switch endswitch
syntax keyword CTermConditional repeat until
"END CONDITIONAL

"REPEAT
syntax keyword CTermRepeat    while
"END REPEAT

" Function arguments (eg $1 $2 $3)
syntax match  CTermFuncArg	"\$[1-9]"

syntax keyword CTermTodo contained TODO

syntax match  CTermNumber		"\<[0-9]\+\(u\=l\=\|lu\|f\)\>"
"floating point number, with dot, optional exponent
syntax match  CTermNumber		"\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=[fl]\=\>"
"floating point number, starting with a dot, optional exponent
syntax match  CTermNumber		"\.[0-9]\+\(e[-+]\=[0-9]\+\)\=[fl]\=\>"
"floating point number, without dot, with exponent
syntax match  CTermNumber		"\<[0-9]\+e[-+]\=[0-9]\+[fl]\=\>"
"hex number
syntax match  CTermNumber		"0x[0-9a-f]\+\(u\=l\=\|lu\)\>"

syntax match  CTermComment		"![^=].*$" contains CTermTodo 
syntax match  CTermComment		"!$"
syntax match  CTermComment		"\*.*$" contains CTermTodo 
syntax region  CTermComment		start="comment" end="$" contains CTermTodo 
syntax region  CTermComment		start="remark" end="$" contains CTermTodo 

syntax region CTermVar	start="\$("  end=")"

" String and Character contstants
" Highlight special characters (those which have a backslash) differently
syntax match   CTermSpecial contained "\\[0-9][0-9][0-9]\|\\."
syntax match   CTermSpecial contained "\^."
syntax region  CTermString		  start=+"+  skip=+\\\\\|\\"+  end=+"+  contains CTermSpecial CTermVar CTermSymbols
syntax match   CTermCharacter	  "'[^\\]'"
syntax match   CTermSpecialCharacter  "'\\.'"

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

	highlight link CTermStatement Statement
	highlight link CTermFunction Statement
	highlight link CTermStrFunction Statement
	highlight link CTermIntFunction Statement
	highlight link CTermLabel Statement
	highlight link CTermConditional Statement
	highlight link CTermRepeat Statement
	highlight link CTermLibFunc UserDefFunc
	highlight link CTermType Type
	highlight link CTermFuncArg PreCondit

	highlight link CTermPreVarRO PreCondit
	highlight link CTermPreVarRW PreConditBold
	highlight link CTermVar Type

	highlight link CTermComment Comment

	highlight link CTermCharacter	Special
	highlight link CTermSpecial		Special
	highlight link CTermSpecialCharacter	Special
	highlight link CTermSymbols	Special
	highlight link CTermString	String
	highlight link CTermTodo	Todo
	highlight link CTermOperator Statement
	highlight link CTermNumber Number

	" redefine the colors
	highlight PreConditBold	term=bold ctermfg=1 cterm=bold guifg=Purple gui=bold
	highlight Special	term=bold ctermfg=6 guifg=SlateBlue gui=underline

endif
