lalr1.cc: don't discard non-existent lookahead on syntax error.

* data/lalr1.cc (parser::parse): Check yyempty first.
* tests/c++.at (Syntax error discarding no lookahead): New test
group.
This commit is contained in:
Joel E. Denny
2009-12-18 23:57:18 -05:00
parent 387b4d5047
commit d59beda068
3 changed files with 85 additions and 3 deletions

View File

@@ -876,7 +876,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
/* Return failure if at end of input. */
if (yyla.type == yyeof_)
YYABORT;
else
else if (!yyempty)
{
yy_destroy_ ("Error: discarding", yyla);
yyempty = true;