# | 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&); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |