##### << comment & keyword processor >> ####
#
#   cmtdefs
#                                                   Dec 03 1991
#                                       mod:        Feb 04 1994
################################################### tonooka ############
#+
#	@(#)Copyright (c) 1992 Yasuhiro Tonooka
#	@(#)cmtdefs 2.2 (Y.Tonooka) 3/28/94
#
#   Language Definition Database File for "cmt"
#
#   "cmt"Ѥθǡ١
#-

#+######################################################################
#
#   TYPE
#	file format
#   NAME
#	Regular Expression - regular expression used in "cmtdefs" and
#			"cmtsufs".
#   DESCRIPTION
#	"Primary Regular Expressions"
#	    c	An ordinary character matches that character.
#
#	    \c	A backslash followed by an arbitrary character matches
#		the character itself except for special escape
#		sequences listed below:
#		    \t		tab
#		    \s		space
#		    \b		backspace
#		    \v		horisontal tab
#		    \f		formfeed
#		    \r		charrage return
#		    \ooo	a character as three octal digits after
#				a backslash like \123
#
#	    .	Matches any character except newline.
#
#	    ^	Matches the beginning of a line.
#
#	    $	Matches the end of a line (newline).
#
#	    (expr)
#		A regular expression enclosed in parentheses
#		matches a match for the regular expression.
#
#	    [string]
#		Character class:  Matches any one character in that
#		string.  If the first character of the string is a `^',
#		matches any character except newline and the remaining
#		characters in the string.  The `-' may be used to
#		indicate a range of consecutive characters.  The `-'
#		and `]' loses their special meaning if it occurs first
#		(after an initial `^', if any) in the string; i.e.,
#		[]a-f] matches either `]' (a right square bracket ) or
#		one of the letters `a' through `f' inclusive.  An
#		escape sequence (preceded by a backslash) is available.
#
#	"Operators"
#	    |	Alternation:  Two regular expressions separated by `|'
#		match either a match for the first or a match for the
#		second.
#
#	    *	Closure:  Matches zero or more occurences.
#
#	    +	Closure:  Matches one or more occurences.
#
#	    ?	Closure:  Matches zero or one occurence.
#
#	"Concatenation"
#	    The concatenation of regular expressions is a regular
#	    expression that matches the concatenation of the strings
#	    matched by each component of the regular expression.
#
#	"The Order of Precedence"
#           The order of precedence of operators at the same
#	    parenthesis level:
#		*	+	?
#		concatenation
#		|
#   NOTE
#	If it is necessary to place a : in a regular expression, it
#	must be escaped in octal as \072.
#
#-######################################################################

#+######################################################################
#
#   TYPE
#	file format
#   NAME
#	cmtdefs - language definition database
#   DESCRIPTION
#	nm	    ---	reg expr for language name
#	fn	    ---	reg expr for file name
#
#	cb & ab	    ---	reg expr introducing a comment
#	ce & ae	    ---	reg expr ending a comment
#			(comments are underlined)
#
#	sb & hb	    ---	reg expr introducing a string or char const
#	sn & hn	    ---	string matched is ignored
#	se & he	    ---	reg expr ending a string or char const
#			(strings or char consts are unchanged)
#
#	pb	    ---	reg expr introducing preprocessor mode
#	pn	    ---	string matched is ignored
#	pe	    ---	reg expr ending preprocessor mode
#
#	id	    ---	identifier pattern (for the both mode)
#	nc	    ---	numeric constant pattern (just ignored)
#
#	oc	    ---	case-insensitive flag
#	al	    ---	"all identifiers" flag (make all identifiers
#			boldfaced)
#
#	kw	    ---	keyword list for normal mode
#	pw	    ---	keyword list for preprocessor mode
#			(keywords are made boldfaced)
#
#-######################################################################

PASCAL:\
	:nm=p|pascal|PASCAL:\
	:fn=.*\.p(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb={:ce=}:\
	:ab=\(\*:ae=\*\):\
	:sb=':se=':\
	:oc:\
	:nc=[0-9]+(\.[0-9])?(e[-+]?[0-9]+)?:\
	:id=[a-z][a-z0-9]*:\
	:kw=and array begin case const div do downto else end file for\
	forward function goto if in label mod nil not of or packed\
	procedure program record repeat set then to type until var\
	while with:
#	assert oct hex external

C:\
	:nm=c|C:\
	:fn=.*\.[ch](\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=/\*:ce=\*/:\
	:sb=":se="|$:sn=\\(.|$):\
	:hb=':he='|$:hn=\\(.|$):\
	:pb=^#:pe=$:pn=\\(.|$)|<.*>:\
	:nc=(0x[0-9a-fA-F]+|([0-9]+(\.[0-9]*)?|\.[0-9]+)\
([eE][-+]?[0-9]+)?)[fluFLU]*:\
	:id=[a-zA-Z_][a-zA-Z0-9_]*:\
	:kw=asm auto break case char const continue default do double\
	else enum extern float for fortran goto if int long register\
	return short signed sizeof static struct switch typedef union\
	unsigned void volatile while:\
	:pw=define defined elif else endif error if ifdef ifndef\
	include line pragma undef:

yacc:\
	:nm=y|yacc:\
	:fn=.*\.y(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=/\*:ce=\*/:\
	:sb=":se="|$:sn=\\(.|$):\
	:hb=':he='|$:hn=\\(.|$):\
	:pb=^#:pe=$:pn=\\(.|$)|<.*>:\
	:nc=(0x[0-9a-fA-F]+|([0-9]+(\.[0-9]*)?|\.[0-9]+)\
([eE][-+]?[0-9]+)?)[fluFLU]*:\
	:id=%?[a-zA-Z_][a-zA-Z0-9_]*|%[%{}]:\
	:kw=asm auto break case char const continue default do double\
	else enum extern float for fortran goto if int long register\
	return short signed sizeof static struct switch typedef union\
	unsigned void volatile while\
	%% %left %nonassoc %prec %right %start %token\
	%type %union %{ %}:\
	:pw=define defined elif else endif error if ifdef ifndef\
	include line pragma undef:

lex:\
	:nm=l|lex:\
	:fn=.*\.l(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=/\*:ce=\*/:\
	:sb=":se="|$:sn=\\(.|$):\
	:hb=':he='|$:hn=\\(.|$):\
	:pb=^#:pe=$:pn=\\(.|$)|<.*>:\
	:nc=(0x[0-9a-fA-F]+|([0-9]+(\.[0-9]*)?|\.[0-9]+)\
([eE][-+]?[0-9]+)?)[fluFLU]*:\
	:id=%?[a-zA-Z_][a-zA-Z0-9_]*|%[%{}]:\
	:kw=asm auto break case char const continue default do double\
	else enum extern float for fortran goto if int long register\
	return short signed sizeof static struct switch typedef union\
	unsigned void volatile while\
	%% %p %n %n %e %a %k %o %{ %}:\
	:pw=define defined elif else endif error if ifdef ifndef\
	include line pragma undef:

C++:\
	:nm=cc|c++|C++:\
	:fn=.*\.(c++|cc|C)(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=/\*:ce=\*/:\
	:ab=//:ae=$:\
	:sb=":se="|$:sn=\\(.|$):\
	:hb=':he='|$:hn=\\(.|$):\
	:pb=^#:pe=$:pn=\\(.|$)|<.*>:\
	:nc=(0x[0-9a-fA-F]+|([0-9]+(\.[0-9]*)?|\.[0-9]+)\
([eE][-+]?[0-9]+)?)[fluFLU]*:\
	:id=[a-zA-Z_][a-zA-Z0-9_]*:\
	:kw=asm auto break case char const continue default do double\
	else enum extern float for fortran goto if int long register\
	return short signed sizeof static struct switch typedef union\
	unsigned void volatile while\
	class delete friend inline new operator overload private\
	protected public virtual:\
	:pw=define defined elif else endif error if ifdef ifndef\
	include line pragma undef:

FORTRAN:\
	:nm=f|f77|fortran|FORTRAN:\
	:fn=.*\.f(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=^[c\*]:ce=$:\
	:sb=':se='|^.....[\s0]:sn=\\.:\
	:hb=":he="|^.....[\s0]:hn=\\.:\
	:oc:\
	:nc=([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][-+]?[0-9]+)?:\
	:id=[a-z][a-z0-9]*|\.[a-z]+\.:\
	:kw=assign backspace block call character close common complex\
	continue data dimension do double else elseif end endfile endif\
	entry equivalence external file format function go goto if\
	implicit inquire integer intrinsic logical open parameter pause\
	precision print program read real return rewind save stop\
	subroutine then to write\
	.and. .eq. .eqv. .false. .ge. .gt. .le. .lt. .ne. .neqv. .not.\
	.or. .true. .xor.\
	include:
#	:pb=\(:pe=\)|^.....[\s0]:\
#	:pw=.and. .eq. .eqv. .false. .ge. .gt. .le. .lt. .ne. .neqv.\
#	.not. .or. .true. .xor.:

ratfor:\
	:nm=r|ratfor:\
	:fn=.*\.r(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=#:ce=$:\
	:sb=':se=':sn=\\.:\
	:hb=":he=":hn=\\.:\
	:pb=%:pe=$:\
	:oc:\
	:nc=([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][-+]?[0-9]+)?:\
	:id=[a-z][a-z0-9]*|\.[a-z]+\.:\
	:kw=break case dafault do else for if next repeat return\
	switch until while\
	assign backspace block call character close common complex\
	continue data dimension double end endfile entry\
	equivalence external file format function go goto implicit\
	inquire integer intrinsic logical open parameter pause\
	precision print program read real rewind save stop\
	subroutine to write\
	.and. .eq. .eqv. .false. .ge. .gt. .le. .lt. .ne. .neqv. .not.\
	.or. .true. .xor.\
	include:
	:pw=assign backspace block call character close common complex\
	continue data dimension do double else elseif end endfile endif\
	entry equivalence external file format function go goto if\
	implicit inquire integer intrinsic logical open parameter pause\
	precision print program read real return rewind save stop\
	subroutine then to write\
	.and. .eq. .eqv. .false. .ge. .gt. .le. .lt. .ne. .neqv. .not.\
	.or. .true. .xor.\
	include:

# UIL keywords include nonreserved keywords.
UIL:\
	:nm=uil|UIL:\
	:fn=.*\.uil(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=!:ce=$:\
	:ab=/\*:ae=\*/:\
	:sb=(#[a-zA-Z_$][a-zA-Z0-9_$]*)?":se=":sn=\\([0-9]+\\|.):\
	:hb=':he=':hn=\\([0-9]+\\|.):\
	:nc=([0-9]+\.[0-9]*|\.[0-9]+)([eE][-+]?[0-9]+)?|[0-9]+:\
	:id=[a-zA-Z_$][a-zA-Z0-9_$]*:\
	:kw=arguments callbacks controls end exported false gadget\
	identifier include list module off on object private procedure\
	procedures true value widget\
	any argument asciz_string_table asciz_table background boolean\
	case_insensitive case_sensitive character_set color color_table\
	compound_string compound_string_table file float font\
	font_table foreground icon imported integer integer_table\
	managed names objects reason right_to_left string string_table\
	translation_table unmanaged version xbitmapfile\
	keysym rgb single_float user_defined:

PostScript:\
	:nm=ps|postscript|PostScript|POSTSCRIPT:\
	:fn=.*\.(ps|eps|epsf)(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=%:ce=$:\
	:sb=\(:se=\):sn=\\.:\
	:hb=<:he=>:\
	:id=[()<>\[\]{}/]|[^\s\t()<>\[\]{}/%]+:\
	:kw== == [ ]\
	FontDirectory StandardEncoding VMerror\
	abs add aload anchorsearch and arc arcn arcto array ashow\
	astore atan awidthshow banddevice begin bind bitshift\
	bytesavailable cachestatus ceiling charpath clear cleartomark\
	clip clippath closefile closepath concat concatmatrix copy\
	copypage cos count countdictstack countexecstack counttomark\
	currentcacheparams currentdash currentdict currentfile\
	currentflat currentfont currentgray currenthsbcolor\
	currentlinecap currentlinejoin currentlinewidth currentmatrix\
	currentmiterlimit currentpacking currentpoint currentrgbcolor\
	currentscreen currenttransfer curveto cvi cvlit cvn cvr cvrs\
	cvs cvx def defaultmatrix definefont dict dictfull dictstack\
	dictstackoverflow dictstackunderflow div dtransform dup echo\
	end eoclip eofill eq erasepage errordict exch exec execstack\
	execstackoverflow executeonly exit exp false file fill\
	findfont flattenpath floor flush flushfile for forall\
	framedevice ge get getinterval grestore grestoreall gsave gt\
	handleerror identmatrix idiv idtransform if ifelse image\
	imagemask index initclip initgraphics initmatrix interrupt\
	invalidaccess invalidexit invalidfileaccess invalidfont\
	invalidrestore invertmatrix ioerror itransform known kshow\
	le length limitcheck lineto ln load log loop lt makefont mark\
	matrix maxlength mod moveto mul ne neg newpath noaccess\
	nocurrentpoint not null nulldevice or packedarray pathbbox\
	pathforall pop print prompt pstack put putinterval quit rand\
	rangecheck rcheck rcurveto read readhexstring readline\
	readonly readstring renderbands repeat resetfile restore\
	reversepath rlineto rmoveto roll rotate round rrand run save\
	scale scalefont search setcachedevice setcachelimit\
	setcacheparams setcharwidth setdash setflat setfont setgray\
	sethsbcolor setlinecap setlinejoin setlinewidth setmatrix\
	setmiterlimit setpacking setrgbcolor setscreen settransfer\
	show showpage sin sqrt srand stack stackoverflow\
	stackunderflow start status stop stopped store string\
	stringwidth stroke strokepath sub syntaxerror systemdict\
	timeout token transform translate true truncate type\
	typecheck undefined undefinedfilename undefinedresult\
	unmatchedmark unregistered userdict usertime version vmstatus\
	wcheck where widthshow write writehexstring writestring\
	xcheck xor:

LaTeX or TeX:\
	:nm=latex|LaTeX|tex|TeX:\
	:fn=.*\.(tex|ind|idx)(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=%:ce=$:\
	:.sb=\\begin{verbatim}:.se=\\end{verbatim}:\
	:.nc=\\[\\%]:\
	:al:\
	:id=[{}\[\]#$&_~^]|\\([a-zA-Z-]+|.)\*?:

LaTeX style file:\
	:nm=sty|latex-sty|LaTeX-sty:\
	:fn=.*\.sty(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=%:ce=$:\
	:al:\
	:id=[{}\[\]#$&_~^]|\\([@a-zA-Z-]+|.)\*?:

#TeX|tex|LaTeX|latex:\
#	:cb=%:ce=$:\
#	:sb=\\begin{verbatim}:se=\\end{verbatim}:\
#	:nc=\\[\\%]:
#	:al:\
#	:id=[#$&_~^]|\\([a-zA-Z]+|.)\*?:

SIMPL:\
	:nm=simpl|SIMPL:\
	:cb=/\*:ce=\*/:\
	:sb=":se=":\
	:hb=':he=':\
	:nc=([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][-+]?[0-9]+)?:\
	:id=[a-zA-Z][a-zA-Z0-9]*|\.[a-zA-Z]+\.:\
	:kw=ARRAY CALL CASE CHAR DO DEFINE ELSE END ENTRY EXIT EXT\
	FILE FOR FUNC IF INT LONG OF OTHER PROC REAL REC REF REPEAT\
	RETURN START STEP STRING THEN UNTIL WHILE\
	.A. .ABS. .AND. .C. .CON. .EQ. .GE. .GT. .LC. .LE. .LL. .LT.\
	.MAX. .MIN. .NE. .NOT. .OR. .RA. .REM. .RL. .V. .X.:

CCL ((c) M.S.I.):\
	:nm=ccl|CCL:\
	:fn=.*\.ccl(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=#/:ce=/#:\
	:ab=#:ae=$:\
	:sb=":se="|$:sn=\\(.|$):\
	:nc=([0-9]*\.[0-9]+|[0-9]+\.?)([eE][-+]?[0-9]+)?\
(da|EPTGMkhdcmunpfa])?:\
	:id=[a-zA-Z_][a-zA-Z0-9_]*:\
	:kw=any auto break clear cont define edit else error exit\
	extern file for goto if include input next numeric on print\
	repeat resume return run shell stop string until while:

make file:\
	:nm=make|makefile|Makefile:\
	:fn=[Mm]akefile.*:\
	:cb=#:ce=$:

C shell:\
	:nm=csh|C-shell:\
	:fn=.*\.csh(\.(BAK|bak|~[0-9]+~)|~)?:\
	:cb=#:ce=$:\
	:sb=":se="|$:sn=\\$:\
	:hb=':he='|$:hn=\\$:\
	:pb=\$#:pe=:\
	:pb=\${?[#?<$]:pe=:\
	:id=(\\.|[^\s\t!;&|<>()`'"$#])*(\\.|[^\s\t!;&|<>()`'"$#\072]):\
	:kw=% @ alias bg break breaksw case cd chdir continue\
	default dirs echo else end endif endsw eval exec exit fg\
	foreach glob goto hashstat history if jobs kill limit login\
	logout nice nohup notify onintr popd pushd rehash repeat set\
	setenv shift source stop suspend switch then time umask unalias\
	unhash unlimit unset unsetenv wait while:
# shell variables
#	argv cdpath cwd echo fignore filec hardpaths histchars history
#	home ignoreeof mail nobeep noclobber noglob nonomatch notify
#	path prompt savehist shell status time verbose
#	user term

Born shell:\
	:nm=sh|shell|B-shell:\
	:.fn=.*\.sh(\.(BAK|bak|~[0-9]+~)|~)?:\
	:fn=.*:\
	:cb=#:ce=$:\
	:sb=":se=":sn=\\("|\\):\
	:hb=':he=':\
	:pb=\${?[-#?$!]:pe=:\
	:id=[a-zA-Z_](\\.|[^\s\t;&|<>()^`'"$=])*|\
(\\.|[^\s\t;&|<>()^`'"$])+:\
	:kw=break case cd continue do done echo elif else esac eval\
	exec exit export fi for getopts hash if in login newgrp pwd\
	read readonly return set shift test then times trap type umask\
	unset until wait while:
