[antlr-interest] SEEK with ANTLR C runtime in tree grammar

Bryce Carman bryce at greentab.net
Fri May 21 14:31:07 PDT 2010


Nevermind. I think I figured out my issue.

It looks like tree->savedIndex is not set automatically like I though it
was.  Setting that field to when I originally parse the target node in the
tree is now allowing me to SEEK to the correct location.

On Thu, May 20, 2010 at 6:52 PM, Bryce Carman <bryce at greentab.net> wrote:

> I'm using the ANTLR C runtime and I am trying to figure out if there is a
> way to jump to an earlier part of the AST during a tree grammar.  I have the
> pANTLR3_BASE_TREE pointer to where I want to jump to, but SEEK seems to
>
> pANTLR3_BASE_TREE tree = *...*
> ANTLR3_MARKER mark = MARK();
> SEEK(tree->savedIndex);
> rule(ctx);
> REWIND(mark);
>
> It seems like after calling SEEK, it is actually moving to the parent of
> the node that I really want to seek to.  Am I doing the MARK, SEEK, REWIND
> correctly for a tree grammar?  Any idea why I actually seem to seek to the
> parent node?
>


More information about the antlr-interest mailing list