summaryrefslogtreecommitdiff
path: root/perly.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-05-27 00:54:18 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-05-27 00:54:18 +0000
commit21612876029045d9a1c77c4382f26aba4c269fb2 (patch)
tree91b3cff9f8f8630e3e486d6585e4c104047657db /perly.c
parent0539ab63267d5a989c8b513c410c39b33c15aa25 (diff)
downloadperl-21612876029045d9a1c77c4382f26aba4c269fb2.tar.gz
make -Dpv display OP names ons the parser stack
p4raw-id: //depot/perl@28316
Diffstat (limited to 'perly.c')
-rw-r--r--perly.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/perly.c b/perly.c
index adf36063f1..77525f82bc 100644
--- a/perly.c
+++ b/perly.c
@@ -140,14 +140,23 @@ yy_stack_print (pTHX_ const short *yyss, const short *yyssp, const YYSTYPE *yyvs
for (i=0; i < count; i++)
PerlIO_printf(Perl_debug_log, " %8d", start+i);
PerlIO_printf(Perl_debug_log, "\nstate:");
- for (i=0, yyss += start; i < count; i++, yyss++)
- PerlIO_printf(Perl_debug_log, " %8d", *yyss);
+ for (i=0; i < count; i++)
+ PerlIO_printf(Perl_debug_log, " %8d", yyss[start+i]);
PerlIO_printf(Perl_debug_log, "\ntoken:");
- for (i=0, yyns += start; i < count; i++, yyns++)
- PerlIO_printf(Perl_debug_log, " %8.8s", *yyns);
+ for (i=0; i < count; i++)
+ PerlIO_printf(Perl_debug_log, " %8.8s", yyns[start+i]);
PerlIO_printf(Perl_debug_log, "\nvalue:");
- for (i=0, yyvs += start; i < count; i++, yyvs++)
- PerlIO_printf(Perl_debug_log, " %8"UVxf, (UV)yyvs->ival);
+ for (i=0; i < count; i++) {
+ if (yy_is_opval[yystos[yyss[start+i]]]) {
+ PerlIO_printf(Perl_debug_log, " %8.8s",
+ yyvs[start+i].opval
+ ? PL_op_name[yyvs[start+i].opval->op_type]
+ : "NULL"
+ );
+ }
+ else
+ PerlIO_printf(Perl_debug_log, " %8"UVxf, (UV)yyvs[start+i].ival);
+ }
PerlIO_printf(Perl_debug_log, "\n\n");
}