From: Peter Rabbitson Date: Tue, 22 Sep 2009 11:00:11 +0000 (+0000) Subject: fix a dumb dumb regex error, /me -- X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=30d09fa92b290297aef2dcc91779846bc15129ac;p=scpubgit%2FQ-Branch.git fix a dumb dumb regex error, /me -- --- diff --git a/Changes b/Changes index e6d7836..5696d2f 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/lib/SQL/Abstract/Test.pm b/lib/SQL/Abstract/Test.pm index 7e38ae8..8b7d43d 100644 --- a/lib/SQL/Abstract/Test.pm +++ b/lib/SQL/Abstract/Test.pm @@ -57,16 +57,21 @@ my @expression_terminator_sql_keywords = ( # * 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;