Function mz_expr_parser::parser::scalar::parse_expr
source ยท pub fn parse_expr(input: ParseStream<'_>) -> Result<MirScalarExpr>
Expand description
Parses a single expression.
Because in EXPLAIN contexts parentheses might be optional, we need to correctly handle operator precedence of infix operators.
Currently, this works in two steps:
- Convert the original infix expression to a postfix expression using an adapted variant of this algorithm with precedence taken from the Postgres precedence docs. Parenthesized operands are parsed in one step, so steps (3-4) from the algorithm are not needed here.
- Convert the postfix vector into a single MirScalarExpr.