[antlr-interest] LT(0) Specification

Brian Cox coxbrian at msu.edu
Sat Jul 1 02:09:39 PDT 2006


On Friday 23 June 2006 10:46, Carleton Coffrin wrote:
>       I am having a problem with the Java version of ANTLR 2.7.5 where
> in the middle of parsing a token stream LT(0) returns 'null'.  In all

I don't know about 2.7.5, but in ANTLR 3 the token stream's LT(0) method is
documented to produce "undefined" results, with null being one of the
possibly appropriate return values.  Only calling LT with non-zero values is
guaranteed to return defined values (that is, the token 'n' steps before or
after the current position in the stream).  It looks like ANTLR 2.7.x has
similar, if not the exact same, behavior.  You'd need help from one of the
ANTLR gurus for more insight as to exactly why that is, since I'm a bit in
the dark about it myself.

--
 * Brian Cox <coxbrian at msu.edu>


More information about the antlr-interest mailing list