use crate::token;
#[derive(Debug, PartialEq, PartialOrd, Eq)]
pub enum Precdence {
Lowest,
Equals,
LessGreater,
Sum,
Product,
Prefix,
Call,
Index,
}
pub fn token_precedence(token: &token::Token) -> Precdence {
match token {
token::Token::Eq | token::Token::NotEq => Precdence::Equals,
token::Token::Lt | token::Token::Gt => Precdence::LessGreater,
token::Token::Plus | token::Token::Minus => Precdence::Sum,
token::Token::Slash | token::Token::Asterisk => Precdence::Product,
token::Token::LParen => Precdence::Call,
token::Token::LBracket => Precdence::Index,
_ => Precdence::Lowest,
}
}