Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!brutus.cs.uiuc.edu!usc!ucsd!chem.ucsd.edu!tps From: tps@chem.ucsd.edu (Tom Stockfisch) Newsgroups: comp.lang.c Subject: Re: LEX rule, anyone??? Message-ID: <625@chem.ucsd.EDU> Date: 11 Dec 89 22:57:24 GMT References: <601@vice2utc.chalmers.se> <21108@mimsy.umd.edu> <364@linqdev.UUCP> Reply-To: tps@chem.ucsd.edu (Tom Stockfisch) Organization: Chemistry Dept, UC San Diego Lines: 17 In article <364@linqdev.UUCP> mark@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@chem.ucsd.edu