Article View: gnu.utils.bug
Article #518Re: flex and multiple inputs
From: Vern Paxson
Date: Fri, 20 Oct 1989 15:41
Date: Fri, 20 Oct 1989 15:41
34 lines
1553 bytes
1553 bytes
In article <ANDREWT.89Oct18222337@watsnew.waterloo.edu> 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:
<<EOF>> {
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)
Technical Details
Message-ID:
<33400@cornell.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!vernReferences:
<ANDREWT.89Oct18222337@watsnew.waterloo.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <ANDREWT.89Oct18222337@watsnew.waterloo.edu> Sender: nobody@cornell.UUCP Reply-To: vern@cs.cornell.edu (Vern Paxson) Organization: Cornell Univ. CS Dept, Ithaca NY Lines: 34