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 Invalid,24}2526impl BinaryOperator {27 pub fn binding_power(&self) -> (u8, u8) {28 match self {29 Self::ObjectApply => (22, 23),30 Self::Mul | Self::Div | Self::Mod => (20, 21),31 Self::Plus | Self::Minus => (18, 19),32 Self::ShiftLeft | Self::ShiftRight => (16, 17),33 Self::LessThan34 | Self::GreaterThan35 | Self::LessThanOrEqual36 | Self::GreaterThanOrEqual37 | Self::In => (14, 15),38 Self::Equal | Self::NotEqual => (12, 13),39 Self::BitAnd => (10, 11),40 Self::BitXor => (8, 9),41 Self::BitOr => (6, 7),42 Self::And => (4, 5),43 Self::Or => (2, 3),44 Self::Invalid => (0, 1),45 }46 }47}