[antlr-interest] Tree parser eats up DOWN node when navigating optional child node

Jim Idle jimi at temporal-wave.com
Wed Aug 4 10:56:36 PDT 2010


Your suggestion will fail when there are no children.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Gerald Rosenberg
> Sent: Wednesday, August 04, 2010 10:54 AM
> To: Junkman
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Tree parser eats up DOWN node when
> navigating optional child node
> 
>   ------ Original Message (Wednesday, August 04, 2010 9:53:09
> AM) From: Junkman ------
> Subject: Re: [antlr-interest] Tree parser eats up DOWN node when
> navigating optional child node
> >
> >> parent: ^(parent_a B?) ;
> >> parent_a: ^(PARENT A?) ;
> >> --------------------------------------------
> >
> 
> . . . is the same as
> 
> parent: ^( ^(PARENT A?) B? ) ;
> 
> which will not match ^(PARENT B), but will match ^( ^(PARENT) B).  BTW, a
> subtree match() will always properly consume the UP DOWN subtree
> delimiters.
> 
> You probably want
> 
> parent: ^(parent_a B?) ;
> parent_a: PARENT A? ;
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list