MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / binary_op_precedence

Function binary_op_precedence

src/sql-parser/src/ast/defs/expr.rs:705–715  ·  view source on GitHub ↗

The precedence of a binary operator, mirroring `Parser::get_next_precedence`. A namespaced `OPERATOR(...)` binds at `OTHER`, like the parser.

(op: &Op)

Source from the content-addressed store, hash-verified

703/// The precedence of a binary operator, mirroring `Parser::get_next_precedence`.
704/// A namespaced `OPERATOR(...)` binds at `OTHER`, like the parser.
705fn binary_op_precedence(op: &Op) -> u8 {
706 if op.namespace.is_some() {
707 return prec::OTHER;
708 }
709 match op.op.as_str() {
710 "=" | "<" | "<=" | "<>" | "!=" | ">" | ">=" => prec::CMP,
711 "+" | "-" => prec::PLUS_MINUS,
712 "*" | "/" | "%" => prec::MULTIPLY_DIVIDE,
713 _ => prec::OTHER,
714 }
715}
716
717/// The precedence at which a prefix operator (`Op` with no second operand)
718/// parses its operand, mirroring `Parser::parse_prefix`: `-`/`+` at

Callers 4

fmtMethod · 0.85
write_quantified_leftFunction · 0.85
right_edgeFunction · 0.85
left_edgeFunction · 0.85

Calls 2

is_someMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected