[antlr-interest] Issue ANTLR-397 - CommonTreeNodeStream.index()

Junkman j at junkwallah.org
Thu Sep 2 10:57:19 PDT 2010


Greetings,

I've encountered the issue noted in the subject -
CommonTreeNodeStream.index() does not return the correct current index
into the stream.  Just reporting to give it any extra visibility it may
so that its fix is incorporated into the next release.

It was an entertaining bug in my case, though.  The method seems to
return an index into its node buffer, and the index may adjust depending
on invocation of LT(n) probably because it can cause buffering
additional nodes.  So, given the same input, I could get different
outcomes if I trace it under a debugger while monitoring LT(n) - like a
heisenbug. :-)  More specifically in my instance, the error recovery
code that uses index() to see if the error recovery is getting stuck, it
leads to different outcomes depending on the index() values when
encountering multiple errors.

BufferedTreeNodeStream seems to serve well as an alternative for now.

Regards,

J





More information about the antlr-interest mailing list