[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Reparsing error
From: |
Anouar LACHHEB |
Subject: |
RE: Reparsing error |
Date: |
Thu, 7 Sep 2006 17:15:32 +0200 |
Hi,
Just a tipo:
(void) PROC_FLUSH_BUF ( yt_unique_datalog_in ); -> (void) PROC_FLUSH_BUF (
yyin );
Sorry.
Best regards,
AnL.
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Anouar LACHHEB
Sent: Thursday, September 07, 2006 5:04 PM
To: address@hidden
Cc: address@hidden
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: address@hidden [
<mailto:address@hidden>
mailto:address@hidden On Behalf Of
Steffen Köhler
Sent: Thursday, September 07, 2006 4:48 PM
To: address@hidden
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
_______________________________________________
address@hidden <http://lists.gnu.org/mailman/listinfo/help-bison>
http://lists.gnu.org/mailman/listinfo/help-bison
_______________________________________________
address@hidden http://lists.gnu.org/mailman/listinfo/help-bison