[antlr-interest] Re: failed assertion in CircularQueue.hpp
Scott Amort
jsamort at gmail.com
Tue Jul 11 07:57:46 PDT 2006
Scott Amort wrote:
> scripts/../lib/cpp/antlr/CircularQueue.hpp:59: void
> antlr::CircularQueue<T>::removeItems(size_t) [with T =
> antlr::TokenRefCount<antlr::Token>]: Assertion `nb <= entries()' failed.
Sorry to be a pain, but has anyone encountered this before? Testing my
library has ground to a halt until I can figure this one out.
It seems to be related to my throwing a SemanticException from within
the parser (during some validation). Here is the actual code that
triggers it:
if ( node->getFirstChild()->getType() == GTokenTypes::GTaggedRange ) {
if ( node->getText() != "requiredrange" ) {
throw antlr::SemanticException(
"tag: '\\" + node->toString() + "' is missing required tagged range",
getFilename(),
node->getLine(),
node->getColumn());
}
}
Nothing out of the ordinary, I don't think, and I use similar code in
numerous other places in the parser with no ill effect. The only
possible difference I can see is that GTaggedRange is a dummy token type
that I manually created during parsing i.e. with:
tokens { // dummy header tokens
...
GTaggedRange;
}
and,
## = #( #[GTaggedRange,"TR"], ## );
The failed assertion only began showing up once I introduced this dummy
header token, but it could be coincidence (and I have used other dummy
header tokens without problems in other parts of the parser).
I realize everyone is working hard on the upcoming ANTLR3, but if
someone could spare a few moments to help me out, I would really
appreciate it!
Best,
Scott
More information about the antlr-interest
mailing list