From ddfd3796a724b8819744876ea0603e68c7e2d340 Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Wed, 12 Jun 2013 16:48:59 +0200
Subject: [PATCH] why not include the lhs in pretty-printed reduce entries?

---
 src/backends/lalr.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/backends/lalr.c b/src/backends/lalr.c
index 66fe42c7..aad47d4d 100644
--- a/src/backends/lalr.c
+++ b/src/backends/lalr.c
@@ -836,15 +836,17 @@ void pprint_lraction(FILE *f, const HCFGrammar *g, const HLRAction *action)
   if(action->type == HLR_SHIFT) {
     fprintf(f, "s%lu", action->nextstate);
   } else {
+    fputs("r(", f);
+    h_pprint_symbol(f, g, action->production.lhs);
+    fputs(" -> ", f);
 #ifdef NDEBUG
     // if we can't print the production, at least print its length
-    fprintf(f, "r[%lu]", action->production.length);
+    fprintf(f, "[%lu]", action->production.length);
 #else
-    fputs("r(", f);
     HCFSequence seq = {action->production.rhs};
     h_pprint_sequence(f, g, &seq);
-    fputc(')', f);
 #endif
+    fputc(')', f);
   }
 }
 
-- 
GitLab