[Bast-commits] r7722 - in SQL-Abstract/1.x/trunk: . lib/SQL/Abstract

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Tue Sep 22 11:00:11 GMT 2009


Author: ribasushi
Date: 2009-09-22 11:00:11 +0000 (Tue, 22 Sep 2009)
New Revision: 7722

Modified:
   SQL-Abstract/1.x/trunk/Changes
   SQL-Abstract/1.x/trunk/lib/SQL/Abstract/Test.pm
Log:
fix a dumb dumb regex error, /me -- 

Modified: SQL-Abstract/1.x/trunk/Changes
===================================================================
--- SQL-Abstract/1.x/trunk/Changes	2009-09-22 10:58:09 UTC (rev 7721)
+++ SQL-Abstract/1.x/trunk/Changes	2009-09-22 11:00:11 UTC (rev 7722)
@@ -1,5 +1,7 @@
 Revision history for SQL::Abstract
 
+    - fix a well masked error in the sql-test tokenizer
+
 revision 1.59  2009-09-22 08:39 (UTC)
 ----------------------------
     - fixed a couple of untrapped undefined warnings

Modified: SQL-Abstract/1.x/trunk/lib/SQL/Abstract/Test.pm
===================================================================
--- SQL-Abstract/1.x/trunk/lib/SQL/Abstract/Test.pm	2009-09-22 10:58:09 UTC (rev 7721)
+++ SQL-Abstract/1.x/trunk/lib/SQL/Abstract/Test.pm	2009-09-22 11:00:11 UTC (rev 7722)
@@ -57,16 +57,21 @@
 # * BETWEEN without paranthesis around the ANDed arguments (which
 #   makes it a non-binary op) is detected and accomodated in 
 #   _recurse_parse()
+my $stuff_around_mathops = qr/[\w\s\`\'\)]/;
 my @binary_op_keywords = (
-  (map { "\Q$_\E" } (qw/< > != = <= >=/)),
-  '(?: NOT \s+)? IN',
-  '(?: NOT \s+)? LIKE',
-  '(?: NOT \s+)? BETWEEN',
+  ( map
+    { " (?<=  $stuff_around_mathops) " . quotemeta $_ . "(?= $stuff_around_mathops )" }
+    (qw/< > != = <= >=/)
+  ),
+  ( map
+    { '\b (?: NOT \s+)?' . $_ . '\b' }
+    (qw/IN BETWEEN LIKE/)
+  ),
 );
 
 my $tokenizer_re_str = join("\n\t|\n",
   ( map { '\b' . $_ . '\b' } @expression_terminator_sql_keywords, 'AND', 'OR', 'NOT'),
-  ( map { q! (?<= [\w\s\`\'\)] ) ! . $_ . q! (?= [\w\s\`\'\(] ) ! } @binary_op_keywords ),
+  @binary_op_keywords,
 );
 
 my $tokenizer_re = qr/ \s* ( \( | \) | \? | $tokenizer_re_str ) \s* /xi;




More information about the Bast-commits mailing list