X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FTree.pm;h=3791fe9d2e94b69ccf025fb1cf4dd9d18b407327;hb=ca4f826a37ccb5194b0b5b9b4190b4007d647d9c;hp=75cf859f083d031a16f05555d1db1a4648e34fdc;hpb=e9f56d7a96845cb9bc73224c560e1118ff362011;p=dbsrgits%2FSQL-Abstract.git diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index 75cf859..3791fe9 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -78,7 +78,7 @@ my $alphanum_cmp_op_re = join ("\n\t|\n", map ); $alphanum_cmp_op_re = qr/$alphanum_cmp_op_re/x; -my $binary_op_re = '(?: NOT \s+)? (?:' . join ('|', qw/IN BETWEEN R?LIKE/) . ')'; +my $binary_op_re = '(?: NOT \s+)? (?:' . join ('|', qw/IN BETWEEN [RI]?LIKE REGEXP/) . ')'; $binary_op_re = join "\n\t|\n", "$op_look_behind (?i: $binary_op_re | AS ) $op_look_ahead", $alphanum_cmp_op_re, @@ -340,7 +340,7 @@ sub _recurse_parse { my @left; while (1) { # left-associative parsing - if ( ! @$tokens + if (! @$tokens or ($state == PARSE_IN_PARENS && $tokens->[0] eq ')') or @@ -418,19 +418,19 @@ sub _recurse_parse { } # unary op keywords - elsif ( $token =~ $unary_op_re ) { + elsif ($token =~ $unary_op_re) { my $op = uc $token; # normalize RNO explicitly $op = 'ROW_NUMBER() OVER' if $op =~ /^$rno_re$/; - my @right = $self->_recurse_parse ($tokens, PARSE_RHS); + my @right = $self->_recurse_parse($tokens, PARSE_RHS); push @left, [ $op => \@right ]; } # expression terminator keywords - elsif ( $token =~ $expr_start_re ) { + elsif ($token =~ $expr_start_re) { my $op = uc $token; my @right = $self->_recurse_parse($tokens, PARSE_IN_EXPR); @@ -438,7 +438,7 @@ sub _recurse_parse { } # a '?' - elsif ( $token =~ $placeholder_re) { + elsif ($token =~ $placeholder_re) { push @left, [ -PLACEHOLDER => [ $token ] ]; } @@ -462,7 +462,7 @@ sub _recurse_parse { and $tokens->[0] !~ $all_std_keywords_re and - ! ( @$tokens > 1 and $tokens->[1] eq '(' ) + ! (@$tokens > 1 and $tokens->[1] eq '(') ) { push @lits, [ -LITERAL => [ shift @$tokens ] ]; }