Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!vern From: vern@utgard.cs.cornell.edu (Vern Paxson) Newsgroups: gnu.utils.bug Subject: Re: flex and multiple inputs Message-ID: <33400@cornell.UUCP> Date: 20 Oct 89 15:41:48 GMT References: Sender: nobody@cornell.UUCP Reply-To: vern@cs.cornell.edu (Vern Paxson) Organization: Cornell Univ. CS Dept, Ithaca NY Lines: 34 In article andrewt@watsnew.waterloo.edu (Andrew Thomas) writes: > I have recently tried to write a parser using bison and flex. It > worked fine on a single input file, but I wanted to read mulitple > files and parse them in the same way.... > Eventually I changed the skeleton file to remove the > 'static' definitions from the function 'yyrestart'.... > This has the desired effect, but now the > line number counting I have put in the .l file is off by the number of > lines in the previous file. Is there a correct way to read multiple > input files with one parser run? Yes. What you want to do is add a rule like: <> { if there's another input file { fclose( yyin ); yyin = fopen( file, "r" ); reset line number counter YY_NEW_FILE; } else return; } This is a new feature so it may be somewhat buggy. If you have problems with it, send me mail. Vern Vern Paxson vern@cs.cornell.edu Computer Science Dept. decvax!cornell!vern Cornell University vern@LBL (bitnet)