Skip to content

Commit

Permalink
fix #386
Browse files Browse the repository at this point in the history
  • Loading branch information
kitta65 committed Jul 2, 2024
1 parent b354f7c commit e1788da
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
25 changes: 25 additions & 0 deletions src/parser/tests/tests_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)),
Expand Down

0 comments on commit e1788da

Please sign in to comment.