fn which_assignment_op(token: &Token) -> Option<Option<BinaryOp>> {
        let op = match token {
            Token::OpAssign    => None,
            Token::OpAddAssign => Some(BinaryOp::Add),
            Token::OpSubAssign => Some(BinaryOp::Sub),
            Token::OpMulAssign => Some(BinaryOp::Mul),
            Token::OpDivAssign => Some(BinaryOp::Div),
            Token::OpModAssign => Some(BinaryOp::Mod),
            Token::OpAndAssign => Some(BinaryOp::BitAnd),
            Token::OpOrAssign  => Some(BinaryOp::BitOr),
            Token::OpXorAssign => Some(BinaryOp::BitXor),
            Token::OpLShiftAssign => Some(BinaryOp::LShift),
            Token::OpRShiftAssign => Some(BinaryOp::RShift),
            
            _ => return None,
        };
        
        Some(op)
    }
// Helper to see if the a token is an assignment operator and if so, which one it is.
Helper to see if the a token is an assignment operator and if so, which one it is.
Helper to see if the a token is an assignment operator and if so which one it is .
fn which_assignment_op(token: &Token) -> Option<Option<BinaryOp>> {
        let op = match token {
            Token::OpAssign    => None,
            Token::OpAddAssign => Some(BinaryOp::Add),
            Token::OpSubAssign => Some(BinaryOp::Sub),
            Token::OpMulAssign => Some(BinaryOp::Mul),
            Token::OpDivAssign => Some(BinaryOp::Div),
            Token::OpModAssign => Some(BinaryOp::Mod),
            Token::OpAndAssign => Some(BinaryOp::BitAnd),
            Token::OpOrAssign  => Some(BinaryOp::BitOr),
            Token::OpXorAssign => Some(BinaryOp::BitXor),
            Token::OpLShiftAssign => Some(BinaryOp::LShift),
            Token::OpRShiftAssign => Some(BinaryOp::RShift),
            _ => return None,
        };
        Some(op)
    }
fn which_assignment_op ( token : & Token ) -> Option < Option < BinaryOp > > { let op = match token { Token :: OpAssign => None , Token :: OpAddAssign => Some ( BinaryOp :: Add ) , Token :: OpSubAssign => Some ( BinaryOp :: Sub ) , Token :: OpMulAssign => Some ( BinaryOp :: Mul ) , Token :: OpDivAssign => Some ( BinaryOp :: Div ) , Token :: OpModAssign => Some ( BinaryOp :: Mod ) , Token :: OpAndAssign => Some ( BinaryOp :: BitAnd ) , Token :: OpOrAssign => Some ( BinaryOp :: BitOr ) , Token :: OpXorAssign => Some ( BinaryOp :: BitXor ) , Token :: OpLShiftAssign => Some ( BinaryOp :: LShift ) , Token :: OpRShiftAssign => Some ( BinaryOp :: RShift ) , _ => return None , } ; Some ( op ) }
Helper to see if the a token is an assignment operator and if so, which one it is.
Helper to see if the a token is an assignment operator and if so which one it is .
token
&Token
token
&Token