[antlr-interest] Assertion failure
Ric Klaren
ric.klaren at gmail.com
Thu Mar 24 16:13:31 PST 2005
togol machillan wrote:
> I get the following error messages at run time due to assertion failure.
>
> col == 1
> Assertion failed: nb <= entries(), file c:\antlr-2.7.5\lib\cpp\antlr\circularqueue.hpp, line 59
>
> Here col is a global integer variable which has the column number of the keyword after that rule is called. The rule which generates this message looks like
>
> paragraph: keyword {col == 1} ...
> ;
>
> keyword: t:"TITLE" {col = t->getColumn();}
> |in:"IN-UNITS" {col = t->getColumn();}
> |data:"DATABANKS" {col = t->getColumn();}
> ;
>
>
> The difficulty is that the assertion fails even when the keyword like TITLE
> occurs in column 1. Can somebody please explain how to avoid this
> assertion failure.
Could you send me a copy of the grammar that triggers this (if possible)
preferably pruned down to a minimal example that triggers the problem
together with the input? I'm short on time but I try to have a look.
> Secondly, is there a better way of getting the column number in the
> keyword rule without defining a label for every alternative literal.
keyword: {col = LT(1)->getColumn();} t:"TITLE"
| {col = LT(1)->getColumn();} in:"IN-UNITS"
| {col = LT(1)->getColumn();} data:"DATABANKS"
;
Should probably work. (LT(1) refers to the first lookahead token)
Cheers,
Ric
>
> Thank you all for your helpful suggestions to my previous queries.
>
> Togol
>
More information about the antlr-interest
mailing list