[net.unix-wizards] Comment recognition in Lex

bergsten@chalmers.UUCP (Per Bergsten) (05/13/84)

%{
/*
**	This solution is at least easy to understand (if you read
**	the last pages in the Lex manual).
**	The OTHER start-condition can, with some care, be eliminated.
**	In any case .* patterns will interfere with the ones below.
**
**	Per Bergsten
**	Departement of Computer Sciences
**	Chalmers University of Technology
**	Goteborg
**	Sweden
*/
%}
%Start COMMENT OTHER
%%
<OTHER>"/*"			{ BEGIN COMMENT; ECHO; }
<COMMENT>"*/"			{ BEGIN OTHER; ECHO; }
<COMMENT>(.|\n)			{ ECHO; };
(.|\n)				;
%%
yywrap() { return (1); }

main()
{
	BEGIN OTHER;
	yylex();
}