[Bps-public-commit] dbix-searchbuilder branch, master, updated. 1.56_03-7-gcf6f0c8
Ruslan Zakirov
ruz at bestpractical.com
Thu Sep 9 21:25:28 EDT 2010
The branch, master has been updated
via cf6f0c878cc813a11a183eb2f0a9020d544d7105 (commit)
from b117b41ea95efa5ee191bf825a1cbb2b84ce5e29 (commit)
Summary of changes:
SearchBuilder/Handle.pm | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit cf6f0c878cc813a11a183eb2f0a9020d544d7105
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Sep 10 00:12:07 2010 +0400
catch cases when there are more closing parens then should be
diff --git a/SearchBuilder/Handle.pm b/SearchBuilder/Handle.pm
index 12c8a4b..cd264f2 100755
--- a/SearchBuilder/Handle.pm
+++ b/SearchBuilder/Handle.pm
@@ -1230,9 +1230,10 @@ sub MayBeNull {
};
# solve boolean expression we have, an answer is our result
+ my $parens_count = 0;
my @tmp = ();
while ( defined ( my $e = shift @conditions ) ) {
- #warn "@tmp >>>$e<<< @conditions";
+ #print "@tmp >>>$e<<< @conditions\n";
return $e if !@conditions && !@tmp;
unless ( $e ) {
@@ -1250,7 +1251,7 @@ sub MayBeNull {
my $close_p = $closing_paren->(0);
splice @conditions, 0, $close_p + 1, (0);
} else {
- die "lost @tmp >>>$e $aggreg<<< @conditions";
+ die "unknown aggregator: @tmp $e >>>$aggreg<<< @conditions";
}
} elsif ( $e eq '1' ) {
if ( $conditions[0] eq ')' ) {
@@ -1267,15 +1268,19 @@ sub MayBeNull {
# 1 AND x == x
next;
} else {
- die "lost @tmp >>>$e $aggreg<<< @conditions";
+ die "unknown aggregator: @tmp $e >>>$aggreg<<< @conditions";
}
} elsif ( $e eq '(' ) {
if ( $conditions[1] eq ')' ) {
splice @conditions, 1, 1;
} else {
+ $parens_count++;
push @tmp, $e;
}
} elsif ( $e eq ')' ) {
+ die "extra closing paren: @tmp >>>$e<<< @conditions"
+ if --$parens_count < 0;
+
unshift @conditions, @tmp, $e;
@tmp = ();
} else {
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list