From: Dave Mitchell Date: Sat, 27 May 2006 00:54:18 +0000 (+0000) Subject: make -Dpv display OP names ons the parser stack X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21612876029045d9a1c77c4382f26aba4c269fb2;p=p5sagit%2Fp5-mst-13.2.git make -Dpv display OP names ons the parser stack p4raw-id: //depot/perl@28316 --- diff --git a/perly.c b/perly.c index adf3606..77525f8 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"); }