/* cee2html.ft - pretzel formatted token file for simple C
 *
 * target formatter: HTML
 *
 * based on c.ft (which has target formatter LaTeX)
 *
 * $Id: cee2html.ft,v 1.1 1996/12/16 18:53:15 gaertner Exp $
 *
 * History at end.
 */

ALPH	[a-zA-Z]
ALPHNUM	[a-zA-Z0-9\_]
ALPHNUMDOT	[a-zA-Z0-9\.]
NUM	[0-9]

%%

	// unary or binary operators for math mode

"+"		|
"-"		|
"*"		UNORBINOP
"/"		|
"<"		UNORBINOP	{ "&lt;" }
"="		UNORBINOP
">"		UNORBINOP	{ "&gt;" }
"."		|
"|"		BINOP
"%"		BINOP
"?"		QUESTION
"!"		UNOP
"~"		UNOP
"&"		UNORBINOP	{ "&amp;" }
","		COMMA

"("		LPAR
"["		LPAR
")"		RPAR
"]"		RPAR
"{"		LBRACE
"}"		RBRACE
";"		SEMI
":"		COLON

"++"		UNOP
"--"		UNOP

	// binary operators for math mode

"!="		BINOP
"<="		BINOP		{ "&lt;=" }
">="		BINOP		{ "&gt;=" }
"=="		BINOP
"&&"		BINOP		{ "&amp;&amp;" }
"||"		BINOP
"->"		BINOP
">>"		BINOP		{ "&gt;&gt;" }
"<<"		BINOP		{ "&lt;&lt;" }
"::"		UNORBINOP

	// preprocessor directives:

"#"		INSERT


"#include"	|
"#ifdef"	|
"#ifndef"	|
"#undef"	|
"#elif"		|
"#error"	|
"#pragma"	|
"#endif"	LPROC		{ "<b>" + ** + "</b>" }

"this"		|
"NULL"	        NUMBER

	// reserved words:

  // types and alike:

"auto"		|
"char"		|
"const"		|
"double"	|
"extern"	|
"FILE"		|
"float"		|
"int"		|
"long"		|
"register"	|
"short"		|
"static"	|
"unsigned"	|
"volatile"	|
"void"		|
"friend"	|
"inline"	|
"virtual"	|
"signed"	INT_LIKE	{ "<b>" + ** + "</b>" }

"enum"		|
"union"		|
"class"		|
"struct"	STRUCT_LIKE	{ "<b>" + ** + "</b>" }

"delete"	|
"new"		|
"operator"	|
"sizeof"	SIZEOF_LIKE	{ "<b>" + ** + "</b>" }

"define"	DEFINE_LIKE	{ "<b>" + ** + "</b>" }

  // case statement handling:

"break"		|
"case"		|
"continue"	|
"default"	|
"private"	|
"protected"	|
"public"	|
"template"	|
"return"	CASE_LIKE	{ "<b>" + ** + "</b>" }

"switch"	IF_LIKE		{ "<b>" + ** + "</b>" }



  // control structures:

"do"		DO_LIKE		{ "<b>" + ** + "</b>" }
"else"		ELSE_LIKE	{ "<b>" + ** + "</b>" }
"for"		|
"if"		|
"while"		IF_LIKE		{ "<b>" + ** + "</b>" }

  // type constructors

"typedef"	TYPEDEF_LIKE	{ "<b>" + ** + "</b>" }


  // comments:

"/*"[^\*]*"*/"	INSERT


\'.\'		STRING

  // strings

\"[^\"]*\"	STRING

"<"{ALPHNUMDOT}+">" LPROC   { "\n@literal \\verb|" ** "|\n" }

  // chunks and other stuff for noweb:

^"@use\ ".*	CHUNK	{ "\n" + ** + "\n" }

^"@".*		IGNORE	{ "\n" + **  + "\n" }



{ALPH}{ALPHNUM}*	ID


{NUM}+		NUMBER



[\ \t\n]		// gobble up whitespace

.			// forget all non-standard characters
			// somehow some strange characters are
			// sent to pretzel (TODO). forget them.

%%

/*
 * $Log: cee2html.ft,v $
 * Revision 1.1  1996/12/16 18:53:15  gaertner
 * Initial revision
 *
 *
 */
