[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
yyparse more than once
From: |
Prabhu M.K |
Subject: |
yyparse more than once |
Date: |
Thu, 24 Jan 2002 21:27:10 +0530 |
Hi all
I am calling yyparse more than once like one below
#include <iostream.h>
#include <stdio.h>
extern void yyrestart(FILE *);
static int flag;
extern int yylex();
extern FILE * yyin;
extern int yyparse();
int paser();
int
parse()
{
yyin= fopen("example","r");
if(flag)
flag = 0;
else
yyrestart(yyin);
yyparse();
fclose(yyin);
return 0;
}
main()
{
flag = 1;
parse();
parse();
}
I am using bison 1.25 and Flex for parser and scanner generator...
The first call is completed successfully where as the second call
failed...
The output is looking like below one...
--(end of buffer or a NUL) ----->(First call of yyparse)
--accepting rule at line 60 ("<?EML-VERSION 1.0?>")
--accepting rule at line 69 ("
<?ETT")
--accepting rule at line 59 (" ")
goes on......
--(end of buffer or a NUL)
yywrap called
--EOF (start condition 1)
---> (First call is
finished)
--(end of buffer or a NUL) ---->(Second call of yyparse)
--accepting rule at line 75 ("<")
Got an Error
!ERROR(<)
--accepting rule at line 74 ("?EML-VERSION 1.0?>")
Syntax error: parse error
Press any key to continue
Where am goin wrong
Advance Thanks
Prabhu M.K
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com