X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FTree.pm;h=c3e15558725c16a6ae6c20ad9a747eae9d8d5818;hb=6f30911f8a77b8f2b466f9ecaa9d6d5c2b788c3a;hp=8e743a64dd469f7b495d453ff43610f744164fae;hpb=1ec9b9e3261f37de1bd05b31fa3c88ab78ab1480;p=scpubgit%2FQ-Branch.git diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index 8e743a6..c3e1555 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -447,13 +447,16 @@ sub _recurse_parse { } # we're now in "unknown token" land - start eating tokens until - # we see something familiar + # we see something familiar, OR in the case of RHS (binop) stop + # after the first token else { my @lits = [ -LITERAL => [$token] ]; - while (@$tokens and $tokens->[0] !~ $all_std_keywords_re) { - push @lits, [ -LITERAL => [ shift @$tokens ] ]; - } + unless ( $state == PARSE_RHS ) { + while (@$tokens and $tokens->[0] !~ $all_std_keywords_re) { + push @lits, [ -LITERAL => [ shift @$tokens ] ]; + } + } if (@left == 1) { unshift @lits, pop @left; @@ -465,10 +468,13 @@ sub _recurse_parse { } if (@$tokens) { - # asc/desc + + # deal with post-fix operators (asc/desc) if ($tokens->[0] =~ $asc_desc_re) { @left = [ ('-' . uc (shift @$tokens)) => [ @left ] ]; } + + return @left if $state == PARSE_RHS and $left[-1][0] eq '-LITERAL'; } } }