bison-patches
[Top][All Lists]
Advanced

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

[PATCH] stack::size instead of stack::height.


From: Akim Demaille
Subject: [PATCH] stack::size instead of stack::height.
Date: Tue, 21 Oct 2008 18:04:46 -0500

        * data/lalr1.cc (stack::height): Rename as...
        (stack::size): this.
        Fix the output type.
        Comment changes.
---
 ChangeLog     |    8 ++++++++
 data/lalr1.cc |   12 ++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a7e2b72..2c8de9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-11-03  Akim Demaille  <address@hidden>
 
+       stack::size instead of stack::height.
+       * data/lalr1.cc (stack::height): Rename as...
+       (stack::size): this.
+       Fix the output type.
+       Comment changes.
+
+2008-11-03  Akim Demaille  <address@hidden>
+
        Use variants to support objects as semantic values.
        This patch was inspired by work by Michiel De Wilde.  But he used Boost
        variants which (i) requires Boost on the user side, (ii) is slow, and
diff --git a/data/lalr1.cc b/data/lalr1.cc
index de2c1de..cf44d1f 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -897,7 +897,7 @@ b4_error_verbose_if([, yytoken])[));
        }
 
        /* Pop the current state because it cannot handle the error token.  */
-       if (yystate_stack_.height () == 1)
+       if (yystate_stack_.size () == 1)
        YYABORT;
 
        yyerror_range[0] = yylocation_stack_[0];
@@ -940,7 +940,7 @@ b4_error_verbose_if([, yytoken])[));
     /* Do not reclaim the symbols of the rule which action triggered
        this YYABORT or YYACCEPT.  */
     yypop_ (yylen);
-    while (yystate_stack_.height () != 1)
+    while (yystate_stack_.size () != 1)
       {
        yydestruct_ ("Cleanup: popping",
                   yystos_[yystate_stack_[0]],
@@ -1235,17 +1235,17 @@ b4_copyright([Stack handling for Bison parsers in C++],
     }
 
     inline
-    unsigned int
-    height () const
+    typename S::size_type
+    size () const
     {
       return seq_.size ();
     }
 
     inline const_iterator begin () const { return seq_.rbegin (); }
-    inline const_iterator end () const { return seq_.rend (); }
+    inline const_iterator end ()   const { return seq_.rend ();   }
 
   private:
-
+    /// The wrapped container.
     S seq_;
   };
 
-- 
1.6.0.2.588.g3102





reply via email to

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