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

pull/2/head
ondra05 2021-08-30 22:18:09 +02:00
parent 19743f3c0b
commit 6570292323
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 {