ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/antlr/CircularQueue.hpp
(Generate patch)

Comparing:
trunk/src/antlr/CircularQueue.hpp (file contents), Revision 770 by tim, Fri Dec 2 15:38:03 2005 UTC vs.
branches/development/src/antlr/CircularQueue.hpp (file contents), Revision 1633 by gezelter, Thu Sep 15 13:39:36 2011 UTC

# Line 5 | Line 5
5   * Project led by Terence Parr at http://www.jGuru.com
6   * Software rights: http://www.antlr.org/license.html
7   *
8 < * $Id: CircularQueue.hpp,v 1.1 2005-12-02 15:38:02 tim Exp $
8 > * $Id$
9   */
10  
11   #include <antlr/config.hpp>
# Line 56 | Line 56 | class ANTLR_API CircularQueue { (public)
56          }
57          inline void removeItems( size_t nb )
58          {
59 <                assert(nb <= entries());
59 >                // it would be nice if we would not get called with nb > entries
60 >                // (or to be precise when entries() == 0)
61 >                // This case is possible when lexer/parser::recover() calls
62 >                // consume+consumeUntil when the queue is empty.
63 >                // In recover the consume says to prepare to read another
64 >                // character/token. Then in the subsequent consumeUntil the
65 >                // LA() call will trigger
66 >                // syncConsume which calls this method *before* the same queue
67 >                // has been sufficiently filled.
68 >                if( nb > entries() )
69 >                        nb = entries();
70 >
71                  if (m_offset >= OFFSET_MAX_RESIZE)
72                  {
73                          storage.erase( storage.begin(), storage.begin() + m_offset + nb );
# Line 75 | Line 86 | class ANTLR_API CircularQueue { (public)
86          }
87  
88   private:
89 <        typename ANTLR_USE_NAMESPACE(std)vector<T> storage;
89 >        ANTLR_USE_NAMESPACE(std)vector<T> storage;
90          size_t m_offset;
91  
92          CircularQueue(const CircularQueue&);

Comparing:
trunk/src/antlr/CircularQueue.hpp (property svn:keywords), Revision 770 by tim, Fri Dec 2 15:38:03 2005 UTC vs.
branches/development/src/antlr/CircularQueue.hpp (property svn:keywords), Revision 1633 by gezelter, Thu Sep 15 13:39:36 2011 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines