[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Destroy the lhs symbols after reduction.
From: |
Akim Demaille |
Subject: |
[PATCH] Destroy the lhs symbols after reduction. |
Date: |
Mon, 03 Nov 2008 21:01:31 -0000 |
* data/lalr1-fusion.cc (parse): After the user action, when in
variant mode, destroy the lhs symbols.
---
ChangeLog | 6 ++++++
data/lalr1-fusion.cc | 12 ++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 28c3ce8..25d5f6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-11-03 Akim Demaille <address@hidden>
+ Destroy the lhs symbols after reduction.
+ * data/lalr1-fusion.cc (parse): After the user action, when in
+ variant mode, destroy the lhs symbols.
+
+2008-11-03 Akim Demaille <address@hidden>
+
Simplify yysyntax_error_ use.
* data/lalr1-fusion.cc (yysyntax_error_): Always pass it the token
type, but make it unnamed in the declaration when it is not used.
diff --git a/data/lalr1-fusion.cc b/data/lalr1-fusion.cc
index 743a05a..6299d76 100644
--- a/data/lalr1-fusion.cc
+++ b/data/lalr1-fusion.cc
@@ -859,10 +859,13 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
else
yyval = address@hidden@}.value;])[
+ // Compute the default @@$.
{
slice<data_type, stack_type> slice (yystack_, yylen);
YYLLOC_DEFAULT (yyloc, slice, yylen);
}
+
+ // Perform the reduction.
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
@@ -872,6 +875,15 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], yyval, yyloc);
+]b4_variant_if([
+ // Destroy the lhs symbols.
+ for (unsigned i = 0; i < yylen; ++i)
+ {
+ b4_symbol_variant(address@hidden@}.state]]],
+ address@hidden@}.value]],
+ [[destroy]])
+ }])dnl
+[
yypop_ (yylen);
yylen = 0;
YY_STACK_PRINT ();
--
1.6.0.2.588.g3102
- [PATCH] Destroy the lhs symbols after reduction.,
Akim Demaille <=