2008/11/26 Gavin Lambert <[EMAIL PROTECTED]>: > At 09:14 27/11/2008, Oliver Zeigermann wrote: >>Too bad for me as I have this in a tree parser (rule is spelled >>with 3xe on purpose): >> >>treee >> : ^(. treee* ) >> ; >> >>which will never come to see the "treee*" part as the first "." >>matches the complete subtree making my analysis (code is left out >>for clarity) defunct. >> >>Or am I missing something here (as usual). > > I'm not sure how Ter ended up implementing it, but I don't think there > should be any problem with what you have here. > > A wildcard in the 'root' position can only be a single node, because you > can't have a subtree as a root. So the meaning of the above shouldn't have > changed.
I agree with what you say, but in 3.1 this special wildcard consumes the full subtree. > Although incidentally, I would expect the above to fail to match if you have > anything other than subtrees; ie. while it should match this: > > ^(FOO ^(BAR ^(BAZ)) ^(WIBBLE)) > > I would expect it to fail to match this: > > ^(FOO ^(BAR BAZ) WIBBLE) Right. That would be what I had expected as well. But in 3.1 it works the way described above. Would you agree that chaning the rule to treee : ^(. treee* ) | . ; should make it accept the second tree as well? 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 il-antlr-interest@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---