bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/4] c++: report the stack at the same places as in C


From: Akim Demaille
Subject: [PATCH 3/4] c++: report the stack at the same places as in C
Date: Wed, 15 Jan 2020 06:27:02 +0100

Let's have C be the reference, and match it elsewhere.  Maybe C is too
verbose and some adjustments are needed, but then that would be done
in another batch of patches.

* data/skeletons/lalr1.cc: Print the stack once we popped after
YYERROR, and before emptying the stack at the end of parsing.
---
 data/skeletons/lalr1.cc | 2 ++
 tests/c++.at            | 1 +
 2 files changed, 3 insertions(+)

diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index c338e436..9197a267 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -1045,6 +1045,7 @@ b4_dollar_popdef])[]dnl
        this YYERROR.  */
     yypop_ (yylen);
     yylen = 0;
+    YY_STACK_PRINT ();
     goto yyerrlab1;
 
 
@@ -1116,6 +1117,7 @@ b4_dollar_popdef])[]dnl
     /* Do not reclaim the symbols of the rule whose action triggered
        this YYABORT or YYACCEPT.  */
     yypop_ (yylen);
+    YY_STACK_PRINT ();
     while (1 < yystack_.size ())
       {
         yy_destroy_ ("Cleanup: popping", yystack_[0]);
diff --git a/tests/c++.at b/tests/c++.at
index f1afd738..d896af19 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -679,6 +679,7 @@ Entering state 2
 Reading a token: Next token is token EOI ()
 Shifting token EOI ()
 Entering state 3
+Stack now 0 2 3
 Cleanup: popping token EOI ()
 Cleanup: popping nterm expr (40)
 destroy: 40
-- 
2.24.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]