Hi, Just a tipo: (void) PROC_FLUSH_BUF ( yt_unique_datalog_in ); -> (void) PROC_FLUSH_BUF ( yyin );
Sorry. Best regards, AnL. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anouar LACHHEB Sent: Thursday, September 07, 2006 5:04 PM To: [EMAIL PROTECTED] Cc: [email protected] Subject: RE: Reparsing error Hi Steffen, I faced recently the same problem when calling yyparse several times and I found a solution for. But if you refer to the Bison doc (Bison v 1.2), exactly at § "11.2 How Can I Reset the Parser", you'll see that the problem comes with the scanner buffer initialization not the parser. The solution is to flush scanner buffer after changing yyin and before calling yyparse by writing a perso proc in flex source code (after %%): ... %% //lexems/tokens specification %% void PROC_FLUSH_BUF ( FILE * xFile ) { yy_delete_buffer ( YY_CURRENT_BUFFER ); yy_switch_to_buffer ( yy_create_buffer ( xFile, YY_BUF_SIZE ) ); } Then when calling yyparse in your ".c" prog file you should do this: yyin = fopen ( File_Name, "r" ); // test yyin if NULL (void) PROC_FLUSH_BUF ( yt_unique_datalog_in ); Ret = yyparse ( ... ); ... // test on "Ret". ... Best regards, AnL. -----Original Message----- From: [EMAIL PROTECTED] [ <mailto:[EMAIL PROTECTED]> mailto:[EMAIL PROTECTED] On Behalf Of Steffen Köhler Sent: Thursday, September 07, 2006 4:48 PM To: [email protected] Subject: Reparsing error Hello, how can I clear the parser stack? I call yyparse() twice with the same input and get different error messages. I looks that the parser stack is not initialized in yyparse(), the lexer reads the correct tokens. Thanks Steffen _______________________________________________ [email protected] <http://lists.gnu.org/mailman/listinfo/help-bison> http://lists.gnu.org/mailman/listinfo/help-bison _______________________________________________ [email protected] http://lists.gnu.org/mailman/listinfo/help-bison _______________________________________________ [email protected] http://lists.gnu.org/mailman/listinfo/help-bison
