[antlr-interest] Re: A way to find all subtrees of a particular type?

lgcraymer lgc at mail1.jpl.nasa.gov
Wed May 21 15:18:26 PDT 2003


There is a quick fix.  Redefine "equals" in your base AST class so 
that some text string--say ""--matches anything.  That way, "equals" 
has the default behavior in all but the one special case and you get 
the match behavior that you want by using the special string when 
building an AST for the findAllPartial().

--Loring



--- In antlr-interest at yahoogroups.com, "rustydstone" 
<rustydstone at y...> wrote:
> > --- In antlr-interest at yahoogroups.com, Terence Parr <parrt at j...> 
wrote:
> > 
> > > If you find all single MULT nodes have you not found precisely 
what 
> > > you're looking for?
> > > 
> > > Ter
> > 
> > You are absolutely right. Thanks
> 
> There's one small problem though. When creating a target AST, one 
must
> know both target's type and text, otherwise findAllPartial() won't
> work. In case of MULT I know both. In other cases, I do know the
> target's type but not text.
> 
> Any ideas? Thanks


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list