Hi all
I am trying to write a simple grammar just to learn how to use Parse::RecDescent. Why this doesn't work "as expected"?:
my $p2 = Parse::RecDescent->new(q( hyphen : "-" option : "a" | "b" | "c" Format : Entry(s) Pre : hyphen option Post : option hyphen Entry : Pre | Post { use Data::Dumper; print Dumper \%ite +m;} )); $p2->Format('a-'); $p2->Format('-a');
I would expect both strings matching and printing "-a" or "a-", but I get:
$VAR1 = { 'Post' => '-', '__RULE__' => 'Entry' };
i.e. Both are valid patterns, but only the first one triggers the action
I would expect getting this:
$VAR1 = { 'Post' => 'a-', '__RULE__' => 'Entry' }; $VAR1 = { 'Post' => '-a', '__RULE__' => 'Entry' };
I am not getting something obvious here... Any help would be appreciated
citromatik
In reply to Parse::RecDescent grammar definition by citromatik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |