YYACCEPT, YYERROR, and YYABORT, as user actions, should not

destroy the RHS symbols of a rule.
* data/yacc.c (yylen): Initialize to 0.
Keep its value to the number of items to possibly shift.
In particular, a regular successful parse that ends on YYFINAL by
a (internal) YYACCEPT must not have yylen != 0.
(yyerrorlab, yyreturn): Pop the RHS.
Reorder a bit to emphasize the `shifting' bits of code.
(YYPOPSTACK): Now accept a number of items to pop.
* data/lalr1.cc: Likewise.
* data/glr.c: Formatting changes.
Use goto instead of fall through.
* doc/bison.texinfo (Destructor Decl): Complete.
This commit is contained in:
Akim Demaille
2005-12-21 15:28:30 +00:00
parent e14d0ab687
commit a85284cfbd
6 changed files with 89 additions and 79 deletions

5
NEWS
View File

@@ -3,6 +3,11 @@ Bison News
Changes in version 2.1a:
* %destructor vs. YYACCEPT, YYERROR, and YYABORT.
When the parsing/action is cut by the user using one of these
special actions, the stack is freed except the right-hand side
symbols of the current rule.
* GLR, C++ LALR(1) parsers.
These parser skeletons are now distributed with the same special
license exception that the C LALR(1) parser skeleton has had since