[Bps-public-commit] r14566 - in Parse-BooleanLogic: lib/Parse

ruz at bestpractical.com ruz at bestpractical.com
Mon Jul 28 09:14:03 EDT 2008


Author: ruz
Date: Mon Jul 28 09:14:02 2008
New Revision: 14566

Modified:
   Parse-BooleanLogic/lib/Parse/BooleanLogic.pm
   Parse-BooleanLogic/t/basics.t

Log:
* fix problems with boolean operators (AND/OR) in the middle of an operand

Modified: Parse-BooleanLogic/lib/Parse/BooleanLogic.pm
==============================================================================
--- Parse-BooleanLogic/lib/Parse/BooleanLogic.pm	(original)
+++ Parse-BooleanLogic/lib/Parse/BooleanLogic.pm	Mon Jul 28 09:14:02 2008
@@ -44,9 +44,9 @@
 my @tokens = qw[OPERAND OPERATOR OPEN_PAREN CLOSE_PAREN];
 
 use Regexp::Common qw(delimited);
-my $re_operator    = qr[(?i:AND|OR)];
-my $re_open_paren  = qr[\(];
-my $re_close_paren = qr[\)];
+my $re_operator    = qr{\b(?i:AND|OR)\b};
+my $re_open_paren  = qr{\(};
+my $re_close_paren = qr{\)};
 
 my $re_tokens      = qr{(?:$re_operator|$re_open_paren|$re_close_paren)};
 my $re_delim       = qr{$RE{delimited}{-delim=>qq{\'\"}}};

Modified: Parse-BooleanLogic/t/basics.t
==============================================================================
--- Parse-BooleanLogic/t/basics.t	(original)
+++ Parse-BooleanLogic/t/basics.t	Mon Jul 28 09:14:02 2008
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 11;
+use Test::More tests => 14;
 use Test::Deep;
 
 use_ok 'Parse::BooleanLogic';
@@ -68,3 +68,18 @@
     '"OR" OR string',
     [{ operand => '"OR"' }, 'OR', { operand => 'string' }],
 ;
+
+parse_cmp
+    "recORd = 3",
+    [{ operand => "recORd = 3" }],
+;
+
+parse_cmp
+    "op ORheading = 3",
+    [{ operand => "op ORheading = 3" }],
+;
+
+parse_cmp
+    "operAND",
+    [{ operand => "operAND" }],
+;



More information about the Bps-public-commit mailing list