Right. Exactly that is my problem :(
2008/11/27 Sam Harwell <[EMAIL PROTECTED]>:
> That should be correct, but under the current implementation, I believe
> it will match any tree with the . wildcard, then find 0 instances of
> tree. The problem doesn't occur in the rule you have here, but this rule
> will only print 1 line, regardless of the input tree:
>
> tree : ^(. {System.out.println("tree node");} tree*)
>
> Sam
>
> -----Original Message-----
> From: Oliver Zeigermann [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 27, 2008 2:24 AM
> To: Gavin Lambert
> Cc: Terence Parr; Sam Harwell; antlr-interest Interest
> Subject: Re: [antlr-interest] wildcard in tree grammar
>
> 2008/11/27 Gavin Lambert <[EMAIL PROTECTED]>:
>> In other words (in vaguely ANTLR-like syntax):
>>
>> wildtree : ANYNODE | ^(ANYNODE wildtree*) ;
>>
>> . => wild
>> ^(.) => ANYNODE
>> ^(. FOO) => ^(ANYNODE FOO)
>> ^(FOO .) => ^(FOO wildtree)
>> ^(FOO . .) => ^(FOO wildtree wildtree)
>> ^(FOO .+) => ^(FOO wildtree+)
>> ^(FOO .*) => ^(FOO wildtree*)
>
> Using these semantics my original rule
>
> tree : ^(. tree* ) ;
>
> would match any tree even if subtrees are single nodes only, right?
>
> Oliver
>
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---