mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 13:53:03 +00:00
lalr1.cc: destroy $$ when YYERROR is called.
* data/lalr1.cc (yyreduce): Compute the resulting state before running the user action so that yylhs is a valid symbol. (yyerrorlab): Since yylhs is complete (it knows its type), we can simply call yy_destroy_ to destroy $$ on YYERROR invocations. * tests/c++.at (AT_CHECK_VARIANTS): Test YYERROR with variants.
This commit is contained in:
@@ -105,11 +105,12 @@ result:
|
||||
list:
|
||||
/* nothing */ { /* Generates an empty string list */ }
|
||||
| list item { std::swap($][$,$][1); $$.push_back($][2); }
|
||||
| list error { std::swap($][$,$][1); }
|
||||
;
|
||||
|
||||
item:
|
||||
TEXT { std::swap($][$,$][1); }
|
||||
| NUMBER { $][$ = string_cast($][1); }
|
||||
| NUMBER { if ($][1 == 3) YYERROR; else $][$ = string_cast($][1); }
|
||||
;
|
||||
%%
|
||||
|
||||
@@ -188,7 +189,6 @@ AT_CHECK([./list], 0,
|
||||
[0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user