[antlr-interest] How to use LT and LA in predicates?
David Holroyd
dave at badgers-in-foil.co.uk
Sat Apr 21 08:05:16 PDT 2007
On Sat, Apr 21, 2007 at 12:53:43AM +0200, Johannes Luber wrote:
> in the beta book Terence wrote, that one has to define the isTypeName()
> method in this rule somewhere else:
>
> type_id
> : {isTypeName(input.LT(1).getText())}? ID
> ;
>
> Problem is, that LT seems to return only an integer after Eclipse syntax
> analyzer. So how do I get the text?
In the parser, 'input' is a TokenStream instance, which defines,
LT(k) => Token
and (via IntStream, its superclass),
LA(k) => int
Something must be mixed up?
ta,
dave
--
http://david.holroyd.me.uk/
More information about the antlr-interest
mailing list