[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help-bison digest, Vol 1 #187 - 5 msgs
From: |
shri |
Subject: |
Re: Help-bison digest, Vol 1 #187 - 5 msgs |
Date: |
1 Nov 2001 15:22:09 -0000 |
hi
i guess the following might help.
i guess the problem is that flex does not flush the buffer even in case of an
error.hence the next time even if u assign a new buffer,it picks from the point
where it had left, in the old buffer.
u'll have to use the function yyrestart(FILE*).this function of flex destroys
the previous buffer and sets the new buffer to the one indicated by the FILE
pointer.
if u r using start states in ur flex code,in case of parse error u'll have to
intialize the state to the INITIAL state by the macro BEGIN(INITIAL).
heres the pseudo code for that
/*after error occurs */
FILE* yyin= some new file
/*integer flag to indicate new file*/
int newFile=0;
newFile++;
yyrestart(yyin);
yyparse();
/*in flex*/
%{
%}
%%
%{
if(newFile)
{
BEGIN(INITIAL);
newFile--;
}
%}
%%
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Help-bison digest, Vol 1 #187 - 5 msgs,
shri <=