yysyntax_error: fix for consistent error with lookahead.
authorJoel E. Denny <joeldenny@joeldenny.org>
Sun, 7 Nov 2010 21:01:56 +0000 (16:01 -0500)
committerJoel E. Denny <joeldenny@joeldenny.org>
Sun, 7 Nov 2010 21:07:42 +0000 (16:07 -0500)
commit095a1d11ca90852ad224bbf9823bf88b7fff9a57
tree700d1f9b941027d0cf6fe267bf16d364e30fb689
parent678094a2f5f7cdad1b909c4265987c5301ee9540
yysyntax_error: fix for consistent error with lookahead.

* NEWS (2.5): Document.
* data/yacc.c (yysyntax_error): In a verbose syntax error
message while in a consistent state with a default action (which
must be an error action given that yysyntax_error is being
invoked), continue to drop the expected token list, but don't
drop the unexpected token unless there actually is no lookahead.
Moreover, handle that internally instead of returning 1 to tell
the caller to do it.  With that meaning of 1 gone, renumber
return codes more usefully.
(yyparse, yypush_parse): Update yysyntax_error usage.  Most
importantly, set yytoken to YYEMPTY when there's no lookahead.
* data/glr.c (yyreportSyntaxError): As in yacc.c, don't drop the
unexpected token unless there actually is no lookahead.
* data/lalr1.cc (yy::parser::parse): If there's no lookahead,
set yytoken to yyempty_ before invoking yysyntax_error_.
(yy::parser::yysyntax_error_): Again, don't drop the unexpected
token unless there actually is no lookahead.
* data/lalr1.java (YYParser::parse): If there's no lookahead,
set yytoken to yyempty_ before invoking yysyntax_error.
(YYParser::yysyntax_error): Again, don't drop the unexpected
token unless there actually is no lookahead.
* tests/conflicts.at (%error-verbose and consistent
errors): Extend test group to further reveal how the previous
use of the simple "syntax error" message was too general.  Test
yacc.c, glr.c, lalr1.cc, and lalr1.java.  No longer an expected
failure.
* tests/java.at (AT_JAVA_COMPILE, AT_JAVA_PARSER_CHECK): Move
to...
* tests/local.at: ... here.
(_AT_BISON_OPTION_PUSHDEFS): Push AT_SKEL_JAVA_IF definition.
(AT_BISON_OPTION_POPDEFS): Pop it.
(AT_FULL_COMPILE): Extend to handle Java.
(cherry picked from commit d2060f0634f4adfb5db74cce540a9d27806091fe)

Conflicts:

data/lalr1.cc
data/lalr1.java
src/parse-gram.c
src/parse-gram.h
tests/java.at
ChangeLog
NEWS
data/glr.c
data/lalr1.cc
data/lalr1.java
data/yacc.c
src/parse-gram.c
src/parse-gram.h
tests/conflicts.at
tests/java.at
tests/local.at