bison-patches
[Top][All Lists]
Advanced

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

[PATCH] Get rid of yyrhs and yyprhs in glr.c.


From: Akim Demaille
Subject: [PATCH] Get rid of yyrhs and yyprhs in glr.c.
Date: Tue, 25 Nov 2008 20:51:19 +0100

        * data/glr.c (yyrhs, yyprhs): Remove.
        Instead, use the state stack and yystos.
---
 ChangeLog  |    6 ++++++
 data/glr.c |   22 +++++-----------------
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ae87722..8cf0340 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-11-25  Akim Demaille  <address@hidden>
 
+       Get rid of yyrhs and yyprhs in glr.c.
+       * data/glr.c (yyrhs, yyprhs): Remove.
+       Instead, use the state stack and yystos.
+
+2008-11-25  Akim Demaille  <address@hidden>
+
        Flag glr tests.
        * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): If glr, declare it
        as an Autotest keyword.
diff --git a/data/glr.c b/data/glr.c
index 7c65eac..71c7f52 100644
--- a/data/glr.c
+++ b/data/glr.c
@@ -367,19 +367,6 @@ static const ]b4_int_type_for([b4_translate])[ 
yytranslate[] =
 };
 
 #if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
-{
-  ]b4_prhs[
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const ]b4_int_type_for([b4_rhs])[ yyrhs[] =
-{
-  ]b4_rhs[
-};
-
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const ]b4_int_type_for([b4_rline])[ yyrline[] =
 {
@@ -1453,7 +1440,8 @@ yy_reduce_print (yyGLRStack* yystackp, size_t yyk, 
yyRuleNum yyrule,
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+      yy_symbol_print (stderr,
+                       address@hidden(yynrhs, yyi + 1)address@hidden,
                       &]b4_rhs_value(yynrhs, yyi + 1)[
                       ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 
1))[]dnl
                       b4_user_args[);
@@ -1782,11 +1770,11 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
        {
          if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
            YYFPRINTF (stderr, "%*s%s <empty>\n", yyindent+2, "",
-                      yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]));
+                      yytokenName (yystos[yystates[yyi-1]->yylrState]));
          else
            YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
-                      yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]),
-                      (unsigned long int) (yystates[yyi - 1]->yyposn + 1),
+                      yytokenName (yystos[yystates[yyi-1]->yylrState]),
+                      (unsigned long int) (yystates[yyi-1]->yyposn + 1),
                       (unsigned long int) yystates[yyi]->yyposn);
        }
       else
-- 
1.6.0.2.588.g3102





reply via email to

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