Next | Higher-Order Parsing | 31 |
Or "do what A does, but only if the result satisfies some condition":
sub side_condition { my ($A, $condition) = @_; my $parser = sub { my $in = shift; my ($res, $out) = $A->($in) or return; $condition->($res) or return; return ($res, $out); }; }
Next | Copyright © 2007 M. J. Dominus |