It does make sense to have the following action:

. as the first child of a multi-child block matches any single node
. in any other position matches any node or subtree

The following modified check in TreeToNFAConverter should correct the
issues people are seeing. Remember I'm using V3 grammars so let me know
if the translation doesn't work right.

Current:

if ( nfa.grammar.type == Grammar.TREE_PARSER )
{
        $g = factory.build_WildcardTree( $w );
}
else
{
        $g = factory.build_Wildcard( $w );
}

Modified:

if ( nfa.grammar.type == Grammar.TREE_PARSER
        && (w.ChildIndex > 0 || w.Parent.getChild(1).Type == EOA) )
{
        $g = factory.build_WildcardTree( $w );
}
else
{
        $g = factory.build_Wildcard( $w );
}

Note that when w.ChildIndex == 0 and its next sibling is EOA, it means
the . is the child of a closure such as .* , since the other possibility
^(.) is not allowed in a tree parser.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Terence Parr
Sent: Wednesday, November 26, 2008 3:09 PM
To: antlr-interest Interest
Subject: Re: [antlr-interest] wildcard in tree grammar

Hi gang, I've recently fixed how this wildcard thing works in tree  
grammars.

October 21, 2008
* Made . in tree grammar look like ^(. .*) to analysis, though ^(. foo)
   is illegal (can't have . at root). Wildcard is subtree or node.
   Fixed bugs:
     http://www.antlr.org:8888/browse/ANTLR-248
     http://www.antlr.org:8888/browse/ANTLR-344

Not sure why ^(. foo) is illegal...hmm...weird.
Ter

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-addr
ess


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
-~----------~----~----~----~------~----~------~--~---

Reply via email to