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

Function unary_prec

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

The precedence at which a prefix operator (`Op` with no second operand) parses its operand, mirroring `Parser::parse_prefix`: `-`/`+` at `PrefixPlusMinus`, but `~` (and namespaced prefixes) at `Other`, so `~ a + b` parses as `~ (a + b)`. `~` binds looser than `+`/`-`/`*`.

(op: &Op)

Source from the content-addressed store, hash-verified

719/// `PrefixPlusMinus`, but `~` (and namespaced prefixes) at `Other`, so `~ a + b`
720/// parses as `~ (a + b)`. `~` binds looser than `+`/`-`/`*`.
721fn unary_prec(op: &Op) -> u8 {
722 if op.namespace.is_none() && (op.op == "-" || op.op == "+") {
723 prec::PREFIX
724 } else {
725 prec::OTHER
726 }
727}
728
729/// The loosest precedence exposed on `expr`'s *right spine*, the precedence at
730/// which an operator printed immediately to its right would bind *into* it

Callers 1

right_edgeFunction · 0.85

Calls 1

is_noneMethod · 0.80

Tested by

no test coverage detected