; was RE: [PATCH perlio.c pp.c regcomp.c] silence format and comparison warnings
[p5sagit/p5-mst-13.2.git] / perly.c
diff --git a/perly.c b/perly.c
index 18f8606..913ed8a 100644 (file)
--- 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");
 }
 
@@ -331,8 +340,6 @@ Perl_yyparse (pTHX)
     yynerrs = 0;
     yychar = YYEMPTY;          /* Cause a token to be read.  */
 
-
-
     YYDPRINTF ((Perl_debug_log, "Entering state %d\n", yystate));
 
     goto yysetstate;
@@ -613,6 +620,10 @@ Perl_yyparse (pTHX)
            /* Pop the rest of the stack.  */
            while (yyss < yyssp) {
                YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp);
+               if (yy_is_opval[yystos[*yyssp]]) {
+                   YYDPRINTF ((Perl_debug_log, "(freeing op)\n"));
+                   op_free(yyvsp->opval);
+               }
                YYPOPSTACK;
            }
            YYABORT;
@@ -650,6 +661,10 @@ Perl_yyparse (pTHX)
            YYABORT;
 
        YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp);
+       if (yy_is_opval[yystos[*yyssp]]) {
+           YYDPRINTF ((Perl_debug_log, "(freeing op)\n"));
+           op_free(yyvsp->opval);
+       }
        yyvsp--;
 #ifdef DEBUGGING
        yynsp--;