Hi Descendants od Rec.
Subrule/production ordering. I just don't get it.
given this grammar
return new Parse::RecDescent (q{
meaning: proplist
{ if(length($text)) {
print ">>$text<< remains unparsed.\n";
return undef;
}
1; }
| { return undef; }
property: phrase '(' proplist ')'
| '(' proplist ')'
| '~' property
| phrase
proplist: property xor_prop(s?)
| property and_prop(s?)
xor_prop: '|' property
and_prop: ',' property
phrase: /[^\(\)\=\,\|\>\~]+/
});
when I try to parse 'SYN(d(e|f))'
everything goes well. If the string is 'SYN(d(e,f))', a syntax error
is spilled out. If I swap the first two subrules/productions of
proplist, the situation is vice versa.
I found nowhere in the Parse::RecDescent docs, that the ordering of
productions does matter. But it seems it does. If there isn't
something blatantly evident I've overseen this makes writing and
maintenance of these grammars harder than it could be.
--
best regards,
Dipl.-Inf. Richard Jelinek
- The PetaMem Group - Prague/Nuremberg - www.petamem.com -
-= 2325182 Mind Units =-