1#[derive(Clone, Copy, Debug, PartialEq, Eq)]2pub enum BinaryOperator {3 Mul,4 Div,5 Mod,6 Plus,7 Minus,8 ShiftLeft,9 ShiftRight,10 LessThan,11 GreaterThan,12 LessThanOrEqual,13 GreaterThanOrEqual,14 Equal,15 NotEqual,16 BitAnd,17 BitXor,18 BitOr,19 And,20 Or,21 In,22 ObjectApply,23 #[allow(dead_code)]24 Invalid,25}2627impl BinaryOperator {28 pub fn binding_power(&self) -> (u8, u8) {29 match self {30 Self::ObjectApply => (22, 23),31 Self::Mul | Self::Div | Self::Mod => (20, 21),32 Self::Plus | Self::Minus => (18, 19),33 Self::ShiftLeft | Self::ShiftRight => (16, 17),34 Self::LessThan35 | Self::GreaterThan36 | Self::LessThanOrEqual37 | Self::GreaterThanOrEqual38 | Self::In => (14, 15),39 Self::Equal | Self::NotEqual => (12, 13),40 Self::BitAnd => (10, 11),41 Self::BitXor => (8, 9),42 Self::BitOr => (6, 7),43 Self::And => (4, 5),44 Self::Or => (2, 3),45 Self::Invalid => (0, 1),46 }47 }48}