diff --git a/src/parser.rs b/src/parser.rs index f2786c7..f8db847 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -660,7 +660,6 @@ impl Parser { if self.get_token(0)?.literal.as_str() == "*" { dot.push_node("right", self.parse_expr(usize::MAX, false, false, false)?); } else { - // TODO dot.push_node("right", self.parse_expr(precedence, false, as_table, true)?); } left = dot; @@ -888,7 +887,10 @@ impl Parser { node.push_node("left", left); if self.get_token(1)?.is("UNNEST") { self.next_token()?; // IN -> UNNEST - let mut unnest = self.parse_expr(usize::MAX, false, false, false)?; + let mut unnest = self.parse_expr( + 102, // NOTE 102 is a little greater than `(` (calling function) + false, false, false, + )?; unnest.node_type = NodeType::CallingUnnest; node.push_node("right", unnest); } else { diff --git a/src/parser/tests/tests_core.rs b/src/parser/tests/tests_core.rs index c3d274d..5ed87d4 100644 --- a/src/parser/tests/tests_core.rs +++ b/src/parser/tests/tests_core.rs @@ -281,6 +281,31 @@ exprs: self: UNNEST (Identifier) rparen: self: ) (Symbol) +", + 0, + )), + Box::new(SuccessTestCase::new( + "\ +SELECT 1 IN UNNEST(1) AND TRUE +", + "\ +self: SELECT (SelectStatement) +exprs: +- self: AND (BinaryOperator) + left: + self: IN (InOperator) + left: + self: 1 (NumericLiteral) + right: + self: ( (CallingUnnest) + args: + - self: 1 (NumericLiteral) + func: + self: UNNEST (Identifier) + rparen: + self: ) (Symbol) + right: + self: TRUE (BooleanLiteral) ", 0, )),