The precedence of a binary operator, mirroring `Parser::get_next_precedence`. A namespaced `OPERATOR(...)` binds at `OTHER`, like the parser.
(op: &Op)
| 703 | /// The precedence of a binary operator, mirroring `Parser::get_next_precedence`. |
| 704 | /// A namespaced `OPERATOR(...)` binds at `OTHER`, like the parser. |
| 705 | fn 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 |
no test coverage detected