bison-patches
[Top][All Lists]
Advanced

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

[PATCH 1/6] glr: comment changes


From: Akim Demaille
Subject: [PATCH 1/6] glr: comment changes
Date: Sat, 26 Dec 2020 08:11:35 +0100

* data/skeletons/glr.c: A bit more doc.
(yypstates): Rename yyst (only occurrence) to yys (commonly used for
yyGLRState).
* data/skeletons/glr2.cc: Ditto.
Prefer '\n' to "\n".
---
 data/skeletons/glr.c   | 10 +++++++---
 data/skeletons/glr2.cc | 15 ++++++++-------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index f3dcbcb9..29e7761a 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -2651,6 +2651,7 @@ b4_dollar_popdef])[]dnl
 
 /* DEBUGGING ONLY */
 #if ]b4_api_PREFIX[DEBUG
+/* Print *YYS and its predecessors. */
 static void
 yy_yypstack (yyGLRState* yys)
 {
@@ -2662,22 +2663,25 @@ yy_yypstack (yyGLRState* yys)
   YY_FPRINTF ((stderr, "%d@@%ld", yys->yylrState, YY_CAST (long, 
yys->yyposn)));
 }
 
+/* Print YYS (possibly NULL) and its predecessors. */
 static void
-yypstates (yyGLRState* yyst)
+yypstates (yyGLRState* yys)
 {
-  if (yyst == YY_NULLPTR)
+  if (yys == YY_NULLPTR)
     YY_FPRINTF ((stderr, "<null>"));
   else
-    yy_yypstack (yyst);
+    yy_yypstack (yys);
   YY_FPRINTF ((stderr, "\n"));
 }
 
+/* Print the stack #YYK.  */
 static void
 yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
 {
   yypstates (yystackp->yytops.yystates[yyk]);
 }
 
+/* Print all the stacks.  */
 static void
 yypdumpstack (yyGLRStack* yystackp)
 {
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index 6b61e186..5af9f6ae 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -1820,7 +1820,7 @@ public:
     yyreportTree (*yyx0, 2);
     std::cerr << "\nOption 2,\n";
     yyreportTree (*yyx1, 2);
-    std::cerr << "\n";
+    std::cerr << '\n';
 #endif
 
     yyparser.error (]b4_locations_if([*yylocp, ])[YY_("syntax is ambiguous"));
@@ -1829,14 +1829,15 @@ public:
 
   /* DEBUGGING ONLY */
 #if ]b4_api_PREFIX[DEBUG
+  /* Print YYS (possibly NULL) and its predecessors. */
   void
-  yypstates (const glr_state* yyst)
+  yypstates (const glr_state* yys)
   {
-    if (yyst != YY_NULLPTR)
-      yyst->yy_yypstack();
+    if (yys != YY_NULLPTR)
+      yys->yy_yypstack();
     else
       std::cerr << "<null>";
-    std::cerr << "\n";
+    std::cerr << '\n';
   }
 #endif
 
@@ -2778,7 +2779,7 @@ yygetToken (int& yycharp, 
]b4_namespace_ref[::]b4_parser_class[& yyparser, glr_s
         }
       catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
         {
-          YY_DEBUG_STREAM <<  "Caught exception: " << yyexc.what() << 
"\n";]b4_locations_if([
+          YY_DEBUG_STREAM <<  "Caught exception: " << yyexc.what() << 
'\n';]b4_locations_if([
           yylloc = yyexc.location;])[
           yyparser.error (]b4_locations_if([yylloc, ])[yyexc.what ());
           // Map errors caught in the scanner to the error token, so that error
@@ -2993,7 +2994,7 @@ b4_dollar_popdef])[]dnl
         while (true)
           {
             const state_num yystate = yystack.firstTopState()->yylrState;
-            YY_DEBUG_STREAM << "Entering state " << yystate << "\n";
+            YY_DEBUG_STREAM << "Entering state " << yystate << '\n';
             if (yystate == YYFINAL)
               goto yyacceptlab;
             if (yyisDefaultedState (yystate))
-- 
2.29.2




reply via email to

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