[antlr-interest] LA(0)?

Ric Klaren ric.klaren at gmail.com
Mon Jul 10 00:48:14 PDT 2006


Hi,

On 2/22/06, Brian Cox <bcox at wilytech.com> wrote:
> I've been looking at some 3rd party code that uses ANTLR.  It has calls
> to LA(0)
> to get the previous token. I've looked at various examples on the web
> site that use LA(1)
> and LA(2) but not LA(0); does this work?

Think it should work. But that's from the top of my head without
checking the code.

Cheers,

Ric

PS write a little test program, check that it works for the first
token and for a situation where the limit of the cyclic buffer is
reached when backtracking (use a mark call somewhere at the start, see
generated code) Or check the code/comments of TokenBuffer (if memory
serves me right).


More information about the antlr-interest mailing list