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

difftreelog

source

crates/jrsonnet-rowan-parser/src/precedence.rs803 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 => (2, 3),17			Self::Or => (2, 3),18			Self::ErrorNoOperator => (0, 1),19		}20	}21}2223impl UnaryOperatorKind {24	pub fn binding_power(&self) -> ((), u8) {25		match self {26			Self::Minus => ((), 20),27			Self::Not => ((), 20),28			Self::BitNot => ((), 20),29		}30	}31}