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

Prashant Deva prashant.deva at gmail.com
Wed Mar 30 10:21:11 PST 2005


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


More information about the antlr-interest mailing list