[antlr-interest] add new support methods in BaseTree?

Terence Parr parrt at cs.usfca.edu
Wed Oct 22 15:46:57 PDT 2008


On Oct 22, 2008, at 2:10 PM, Gerald Rosenberg wrote:
> Yes, this would be quite helpful.  What other functions are you  
> considering?

I'm wide open to suggestions.

I'm thinking we need a general:

public boolean inContext(String ctx);

where we could use contexts of "CLASS ... METHOD" that says I'm  
directly below a METHOD which is a descendent of a CLASS somewhere  
above. "..." would really be a sort of .* reg ex.  Perhaps an xpath  
[shudder] like thing too where "/CLASS ..." means root must be CLASS...

Also hasAncestor() should have getAncestor() variant too I guess.

Perhaps getAncestors()?  Would return a list of nodes on path to root.

Ter


More information about the antlr-interest mailing list