help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


From: khaw guat_hoon
Subject: (no subject)
Date: Thu, 28 Jun 2001 09:54:23

Hi,
I am trying to built a parser which can scan 2 files alternately with flex 2.5.2 and bison 1.25.

Example of my code is:
extern Boolean eof1;
extern Boolean eof2;
FILE * fileptr1 = fopen("File1", "r");
FILE * fileptr2 = fopen("File2", "r");
while(!(eof1 || eof2)){
 yyin=fileptr1;
 yyparse();
 fileptr1=yyin; //to store back the last left off point
 yyin=fileptr2; //no effect??
 yyparse();
 fileptr2=yyin;
}
fclose(fileptr1);
fclose(fileptr2);

My parser is written to parse a line in a file and return. Parser will set eof1 or eof2 to True if File1 or File2 EOF met. With this, the parser should be reading a line from File1 and a line from File2. However, the parser will always scan File1 since it was the first file assigned to yyin. It seems that the yyin cannot be reassigned to other file pointer. Could somebody help on this? Thanks.

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]