LEX rule, anyone???

Tom Stockfisch tps at chem.ucsd.edu
Tue Dec 12 09:57:24 AEST 1989


In article <364 at linqdev.UUCP> mark at linqdev.UUCP () writes:
>...way of handling C comments...
>
>"/*"        {
>			do  {
>				yytext[0] = yytext[1];
>				if( !( yytext[1] = input() ) )
>					yyerror( 
>					"EOF in comment.  Missing \"*/\"." );
>				} while( yytext[0] != '*' || yytext[1] != '/' );
>			}

Too bad it doesn't work.  Try "/*/*/" as input.  I think it will work if you
clear yytext[1] before the do-while loop.
-- 

|| Tom Stockfisch, UCSD Chemistry	tps at chem.ucsd.edu



More information about the Comp.lang.c mailing list