On 13 Jun 2009, at 13:40, Nicolai Stange wrote:

i wonder how to report an libc error
(maybe ENOMEM, EIO) that has occured in either yylex or yyparse to the
caller of yyparse.

As for the first error, memory allocation error, your program is likely unrecoverable, so just write an error message and exit.

For other errors, I had to write in .l:
  #define YYERRCODE     256
and then
  { std::cerr << "Error: ...\n"; return YYERRCODE; }

Unfortunately, this relies on Bison innards. It C++ .hh header contains
  yyerrcode_ = 256
so this header might be included and used instead.

It would be better if this header contained an official error token. (So I cc some developers.)

  Hans




_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to