# we're now in "unknown token" land - start eating tokens until
# we see something familiar, OR in the case of RHS (binop) stop
# after the first token
+ # Also stop processing when we could end up with an unknown func
else {
my @lits = [ -LITERAL => [$token] ];
unless ( $state == PARSE_RHS ) {
- while (@$tokens and $tokens->[0] !~ $all_std_keywords_re) {
+ while (
+ @$tokens
+ and
+ $tokens->[0] !~ $all_std_keywords_re
+ and
+ ! ( @$tokens > 1 and $tokens->[1] eq '(' )
+ ) {
push @lits, [ -LITERAL => [ shift @$tokens ] ];
}
}
]
], 'Crazy ORDER BY parsed correctly');
-is_deeply( $sqlat->parse("META SELECT * * FROM (SELECT *, FROM foobar baz buzz) foo bar WHERE NOT NOT NOT EXISTS (SELECT 'cr,ap') AND foo.a = ? STUFF and not (foo.b LIKE 'station') and x = y and a = b and GROUP BY , ORDER BY x x1 x2 y asc, max(y) desc x z desc"), [
+is_deeply( $sqlat->parse("META SELECT * * FROM (SELECT *, FROM foobar baz buzz) foo bar WHERE NOT NOT NOT EXISTS (SELECT 'cr,ap') AND foo.a = ? STUFF moar(stuff) and not (foo.b LIKE 'station') and x = y and a = b and GROUP BY , ORDER BY x x1 x2 y asc, max(y) desc x z desc"), [
[
"-LITERAL",
[
]
]
],
+ ],
+ [
+ 'moar',
+ [
+ [
+ '-PAREN',
+ [
+ [
+ '-LITERAL',
+ [
+ 'stuff'
+ ]
+ ]
+ ]
+ ]
+ ]
]
]
],