X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FTest.pm;h=8b7d43d1c9071234bebf9103a2510557c0c52518;hb=0f2b8636560c4634ec2c73116b0a3dbef2052405;hp=cfedf160812f260d1e399e23a0e3d5dd678ceead;hpb=9e8dab3fcb42dd5eeaab3b630bd71018ebc141d3;p=dbsrgits%2FSQL-Abstract.git diff --git a/lib/SQL/Abstract/Test.pm b/lib/SQL/Abstract/Test.pm index cfedf16..8b7d43d 100644 --- a/lib/SQL/Abstract/Test.pm +++ b/lib/SQL/Abstract/Test.pm @@ -57,15 +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+)? 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;