Article View: gnu.utils.bug
Article #512flex and multiple inputs
From: Andrew Thomas
Date: Thu, 19 Oct 1989 02:23
Date: Thu, 19 Oct 1989 02:23
20 lines
1420 bytes
1420 bytes
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. The program always aborted from the parser on the second file saying that EOF had been reached. I tried setting yyin to a new file pointer before calling yyparse but it did not help. Eventually I changed the skeleton file to remove the 'static' definitions from the function 'yyrestart'. Now from the routine which calls yyparse, I set yyin to stdin (so yyrestart won't try to close some other file), then call yyrestart with a pointer to the file I want to read. 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? -- Andrew Thomas andrewt@watsnew.waterloo.edu Systems Design Eng. University of Waterloo "If a million people do a stupid thing, it's still a stupid thing." - Opus
Technical Details
Message-ID:
<ANDREWT.89Oct18222337@watsnew.waterloo.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!watcgl!andrewtShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!watcgl!andrewt From: andrewt@watsnew.waterloo.edu (Andrew Thomas) Newsgroups: gnu.utils.bug Subject: flex and multiple inputs Message-ID: <ANDREWT.89Oct18222337@watsnew.waterloo.edu> Date: 19 Oct 89 02:23:37 GMT Sender: daemon@watcgl.waterloo.edu Distribution: world Organization: University of Waterloo, Waterloo, Ontario, Canada Lines: 20