[antlr-interest] Bug (sort of) in antlr 2.7.xx java implementation

Terence Parr parrt at cs.usfca.edu
Wed Mar 30 11:18:43 PST 2005


Prashant, which version are you using?  2.7.5 has it fixed as far as I 
know (or at least the main line):

     /** Get a lookahead token value */
     public final int LA(int i) throws TokenStreamException {
         fill(i);
         return queue.elementAt(markerOffset + i - 1).getType();
     }

Ter
On Mar 30, 2005, at 10:21 AM, Prashant Deva wrote:

> The TokenBuffer.LA(int i) method uses the 'type' field in antlr.Token
> class directly. It should instead use the 'getType()' method.
> I just had a hell of a debugging session cause i was storing the token
> types elsewhere and had overriden the getType method, just to find out
> that antlr doesn't use it.
>
>   /** Get a lookahead token value */
>   public final int LA(int i) throws TokenStreamException {
>         fill(i);
>         return queue.elementAt(markerOffset + i - 1).type; //should be
> 'getType()'
>     }
>
> PRASHANT
>
>
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com





More information about the antlr-interest mailing list