[antlr-interest] semantic predicates use LT() on IntStream - bad

Mats Behre mb.fgel at ownit.nu
Thu Nov 1 14:28:27 PDT 2007



Terence Parr wrote:
> doh!  Sorry. Can you try casting input to CommonTokenStream or whatever 
> you're using?

Cool! That did the trick (at least so far, the grammar isn't recognising the keywords as such, so I have some more testing to do, but that's probably my fault). I'm probably using CommonTokenStream, as I haven't changed it, but I casted to TokenStream.
Didn't realise that IntStream was a superclass of that, and that the method was actually fed with a TokenStream, should have thought to check...

And thanks, Alexandre, for the suggestion, but this solution is so much simpler.

Now I have only to figure out where my actions and rules have gone astray to give me exceptions at runtime, but that should be pretty straightforward.

Thanks again,
Mats


More information about the antlr-interest mailing list