/* 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	{ "<" }
"="		UNORBINOP
">"		UNORBINOP	{ ">" }
"."		|
"|"		BINOP
"%"		BINOP
"?"		QUESTION
"!"		UNOP
"~"		UNOP
"&"		UNORBINOP	{ "&" }
","		COMMA

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

"++"		UNOP
"--"		UNOP

	// binary operators for math mode

"!="		BINOP
"<="		BINOP		{ "<=" }
">="		BINOP		{ ">=" }
"=="		BINOP
"&&"		BINOP		{ "&&" }
"||"		BINOP
"->"		BINOP
">>"		BINOP		{ ">>" }
"<<"		BINOP		{ "<<" }
"::"		UNORBINOP

	// preprocessor directives:

"#"		INSERT

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

"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	{ "" + ** + "" }

"enum"		|
"union"		|
"class"		|
"struct"	STRUCT_LIKE	{ "" + ** + "" }

"delete"	|
"new"		|
"operator"	|
"sizeof"	SIZEOF_LIKE	{ "" + ** + "" }

"define"	DEFINE_LIKE	{ "" + ** + "" }

  // case statement handling:

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

"switch"	IF_LIKE		{ "" + ** + "" }

  // control structures:

"do"		DO_LIKE		{ "" + ** + "" }
"else"		ELSE_LIKE	{ "" + ** + "" }
"for"		|
"if"		|
"while"		IF_LIKE		{ "" + ** + "" }

  // type constructors

"typedef"	TYPEDEF_LIKE	{ "" + ** + "" }

  // 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
 *
 *
 */
