Removed And and Or ops because they aren't cursed enough

This commit is contained in:
Erin 2021-08-30 22:18:09 +02:00 committed by ondra05
parent 539989e2d0
commit bd7209c004
5 changed files with 1 additions and 31 deletions

View file

@ -164,8 +164,6 @@ pub enum BinOpKind {
Less,
Equal,
NotEqual,
And,
Or,
}
impl BinOpKind {
@ -181,8 +179,6 @@ impl BinOpKind {
Token::LessThan => Ok(Self::Less),
Token::EqualEqual => Ok(Self::Equal),
Token::NotEqual => Ok(Self::NotEqual),
Token::And => Ok(Self::And),
Token::Or => Ok(Self::Or),
t => Err(crate::error::ErrorKind::UnexpectedToken(t)),
}
}

View file

@ -149,8 +149,6 @@ impl ExecEnv {
Less => Value::Bool(lhs < rhs),
Equal => Value::Bool(lhs == rhs),
NotEqual => Value::Bool(lhs != rhs),
And => lhs & rhs,
Or => lhs | rhs,
}
}
Not(expr) => Bool(!self.eval_expr(expr)?.into_bool()),

View file

@ -64,12 +64,6 @@ pub enum Token {
#[token("!=")]
NotEqual,
#[token("&")]
And,
#[token("|")]
Or,
#[token("!|aint")] // also add aint as a not keyword
Not,

View file

@ -209,9 +209,7 @@ impl<'source> Parser<'source> {
| Token::EqualEqual
| Token::NotEqual
| Token::LessThan
| Token::GreaterThan
| Token::And
| Token::Or => Ok(Expr::new(
| Token::GreaterThan => Ok(Expr::new(
self.binop_flow(
BinOpKind::from_token(token).map_err(|e| Error::new(e, self.lexer.span()))?,
buf,

View file

@ -459,22 +459,6 @@ impl PartialOrd for Value {
}
}
impl ops::BitAnd for Value {
type Output = Value;
fn bitand(self, rhs: Self) -> Self::Output {
todo!()
}
}
impl ops::BitOr for Value {
type Output = Value;
fn bitor(self, rhs: Self) -> Self::Output {
todo!()
}
}
impl Display for Value {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {