Skip to content

Commit 7bfc55b

Browse files
committed
Support new token type in perly.c's clear_yystack() and debug dumper
1 parent 66154fd commit 7bfc55b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

perly.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ yy_stack_print (pTHX_ const yy_parser *parser)
166166
case toketype_ival:
167167
PerlIO_printf(Perl_debug_log, " %8" IVdf, (IV)ps->val.ival);
168168
break;
169+
case toketype_svval:
170+
PerlIO_printf(Perl_debug_log, " 0x%" UVxf, PTR2UV(ps->val.svval));
171+
break;
169172
default:
170173
PerlIO_printf(Perl_debug_log, " %8" UVxf, (UV)ps->val.ival);
171174
}
@@ -242,8 +245,8 @@ S_clear_yystack(pTHX_ void *arg)
242245

243246
while (ps > parser->stack) {
244247
LEAVE_SCOPE(ps->savestack_ix);
245-
if (yy_type_tab[yystos[ps->state]] == toketype_opval
246-
&& ps->val.opval)
248+
toketypes toketype = yy_type_tab[yystos[ps->state]];
249+
if (toketype == toketype_opval && ps->val.opval)
247250
{
248251
if (ps->compcv && (ps->compcv != PL_compcv)) {
249252
PL_compcv = ps->compcv;
@@ -253,6 +256,10 @@ S_clear_yystack(pTHX_ void *arg)
253256
YYDPRINTF ((Perl_debug_log, "(freeing op)\n"));
254257
op_free(ps->val.opval);
255258
}
259+
else if (toketype == toketype_svval && ps->val.svval) {
260+
YYDPRINTF ((Perl_debug_log, "(freeing SV)\n"));
261+
SvREFCNT_dec(ps->val.svval);
262+
}
256263
SvREFCNT_dec(ps->compcv);
257264
ps--;
258265
}

0 commit comments

Comments
 (0)