[antlr-interest] Lazy load of CommonTokenStream??

Vitaliy Vitaliy at dbsophic.com
Sun Aug 17 12:50:19 PDT 2008


Hi,



I've encountered some really interesting behavior of the CommonTokenStream:

Right after the constructor of the parser, I'm trying to use the method Size() of CommonTokenStream, to retrieve the number of tokens in the input.

It would return 0, no matter how many tokens actually exist in the input.

BUT funny enough, if I call before that to the method LA(1), then  everything works fine.



Could anyone please enlighten me regarding the reason?

Can it be avoided somehow?  Is there a better way than calling LA(1)?



Many Thanks,

Vitaliy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080817/fa8f38a1/attachment.html 


More information about the antlr-interest mailing list