[Bps-public-commit] r16000 - Parse-BooleanLogic/lib/Parse
ruz at bestpractical.com
ruz at bestpractical.com
Tue Sep 16 17:50:04 EDT 2008
Author: ruz
Date: Tue Sep 16 17:50:03 2008
New Revision: 16000
Modified:
Parse-BooleanLogic/lib/Parse/BooleanLogic.pm
Log:
* fix skip_next
Modified: Parse-BooleanLogic/lib/Parse/BooleanLogic.pm
==============================================================================
--- Parse-BooleanLogic/lib/Parse/BooleanLogic.pm (original)
+++ Parse-BooleanLogic/lib/Parse/BooleanLogic.pm Tue Sep 16 17:50:03 2008
@@ -291,13 +291,13 @@
my @res;
foreach my $entry ( @$tree ) {
- next if $skip_next-- > 0;
+ $skip_next-- and next if $skip_next > 0;
if ( ref $entry eq 'ARRAY' ) {
my $tmp = $self->filter( $entry, $cb, 1 );
if ( !$tmp || (ref $tmp eq 'ARRAY' && !@$tmp) ) {
pop @res;
- $skip_next = 1 unless @res;
+ $skip_next++ unless @res;
} else {
push @res, $tmp;
}
@@ -306,7 +306,7 @@
push @res, $entry;
} else {
pop @res;
- $skip_next = 1 unless @res;
+ $skip_next++ unless @res;
}
} else {
push @res, $entry;
@@ -345,7 +345,7 @@
my ($res, $ea, $skip_next) = (0, 'OR', 0);
foreach my $entry ( @$tree ) {
- next if $skip_next-- > 0;
+ $skip_next-- and next if $skip_next > 0;
unless ( ref $entry ) {
$ea = $entry;
$skip_next++ if ($res && $ea eq 'OR') || (!$res && $ea eq 'AND');
@@ -354,7 +354,7 @@
my $cur;
if ( ref $entry eq 'ARRAY' ) {
- $cur = $self->solve( $entry, $cb, 1 );
+ $cur = $self->solve( $entry, $cb );
} else {
$cur = $cb->( $entry );
}
More information about the Bps-public-commit
mailing list