Dear all,

I've noticed that a CommonTreeNodeStream does not increment its index.
In other words, if I consume a token from the stream, then input.index()
remains 0.

This is bad for tree walkers, because the recover() method will think that
is encounters the same error twice, and skip over the token. See
BaseRecognizer.recover()

I think the problem is in LookaheadStream.remove().
int p is the index, but it gets reset.

  public T remove() {
        T o = get(0);
        p++;
        // have we hit end of buffer and not backtracking?
        if ( p == data.size() && markDepth==0 ) {
            // if so, it's an opportunity to start filling at index 0 again
            clear(); // size goes to 0, but retains memory
        }
        return o;
    }

Things work for me if I skip the clear(); instruction, but perhaps there is
a better solution that can be patched in the next official release.

kind regards

Philippe

--

You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to