git.delta.rocks / jrsonnet / refs/commits / d543e940d74b

difftreelog

source

crates/jrsonnet-rowan-parser/src/precedence.rs776 Bsourcehistory
1use crate::nodes::{BinaryOperatorKind, UnaryOperatorKind};23impl BinaryOperatorKind {4	pub fn binding_power(&self) -> (u8, u8) {5		match self {6			Self::MetaObjectApply => (22, 23),7			Self::Mul | Self::Div | Self::Modulo => (20, 21),8			Self::Plus | Self::Minus => (18, 19),9			Self::Lhs | Self::Rhs => (16, 17),10			Self::Lt | Self::Gt | Self::Le | Self::Ge | Self::InKw => (14, 15),11			Self::Eq | Self::Ne => (12, 13),12			Self::BitAnd => (10, 11),13			Self::BitXor => (8, 9),14			Self::BitOr => (6, 7),15			Self::And => (4, 5),16			Self::NullCoaelse | Self::Or => (2, 3),17			Self::ErrorNoOperator => (0, 1),18		}19	}20}2122impl UnaryOperatorKind {23	pub fn binding_power(&self) -> ((), u8) {24		match self {25			Self::Minus | Self::Not | Self::BitNot | Self::Plus => ((), 20),26		}27	}28}