Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!hogpc!houti!ariel!vax135!floyd!cmcl2!rocky2!rna!n44a!ima!haddock!johnl From: johnl@haddock.UUCP Newsgroups: net.unix-wizards Subject: Re: Re: Comment recognition in Lex, agai - (nf) Message-ID: <161@haddock.UUCP> Date: Mon, 7-May-84 23:40:56 EDT Article-I.D.: haddock.161 Posted: Mon May 7 23:40:56 1984 Date-Received: Thu, 10-May-84 00:28:33 EDT Lines: 21 #R:watmath:-766600:haddock:16800012:000:685 haddock!johnl May 7 14:28:00 1984 The problem with recognizing comments as single Lex tokens is that Lex has a finite sized token buffer. If your comments are bigger than the buffer, you lose. What should work is to put in a COMMENT start state and do this: "/*" BEGIN COMMENT; /* start a comment */ "*/" BEGIN 0; /* return to regular state */ .|\n ; /* throw everything else away */ Unfortunately, I've never had much luck with making lex programs that include start states work. Everybody lets lex recognize the /* and writes C code to eat the comment; if you read the manual page for lex, you'll find exactly that in the example. John Levine, ima!johnl