help-bison
[Top][All Lists]
Advanced

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

Re: problems


From: Hans Aberg
Subject: Re: problems
Date: Mon, 6 May 2002 16:31:42 +0200

Reply-to: address@hidden

At 14:49 +0100 2002/05/06, France, stag3 wrote:
>I work with bison and i a have trouble with it.

Actually, it looks like a Flex problem (see below) (if you now use Flex).
There is now a:
  Help-flex mailing list
  address@hidden
  http://mail.gnu.org/mailman/listinfo/help-flex

>My grammar has no problem when my input is from the dos console but i am
>not able to read my data form a file.
...
>void select_input (FILE *fin)
>{
>        extern FILE *yyin;
>        yyin = fin;
>}

My code (using C++) looks like:

std::istream& operator>>(std::istream& is, pg_parser& parser) {
  yydebug = true;
  parser.isp = &is;
  parser.lex->yyrestart(&is);
  op_lexer = parser.lex;
  if (yyparse() != 0)
    is.setstate(std::ios::failbit);
  else
    is.clear(is.rdstate() & ~(std::ios::failbit | std::ios::badbit));
  return is;
}

As you see, I have put in a yyrestart() -- perhaps you forgot to put that in.

If this is not right for you, you can get better info on the Help Flex list.

  Hans Aberg





reply via email to

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