Subject: | $return should not cause the current production to succeed |
The documentation say:
Note that setting $return doesn't cause the current production
to succeed. It merely tells it what to return if it does succeed.
But:
use Parse::RecDescent;
my $parser = new Parse::RecDescent( q[
rule: 'a' { $return = 1;} 'b'
]);
print $parser->rule("a z"); #should print nothing but print 1
use Test::More qw( no_plan);
use Parse::RecDescent;
my $parser = new Parse::RecDescent( q[
do_not_match: 'a' { $return = 3;} 'z'
]);
isa_ok( $parser, 'Parse::RecDescent', '$parser');
is( $parser->do_not_match("a b"), undef,
'$return doesn\'t cause the current production to succeed');