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, Less,
Equal, Equal,
NotEqual, NotEqual,
And,
Or,
} }
impl BinOpKind { impl BinOpKind {
@ -181,8 +179,6 @@ impl BinOpKind {
Token::LessThan => Ok(Self::Less), Token::LessThan => Ok(Self::Less),
Token::EqualEqual => Ok(Self::Equal), Token::EqualEqual => Ok(Self::Equal),
Token::NotEqual => Ok(Self::NotEqual), Token::NotEqual => Ok(Self::NotEqual),
Token::And => Ok(Self::And),
Token::Or => Ok(Self::Or),
t => Err(crate::error::ErrorKind::UnexpectedToken(t)), t => Err(crate::error::ErrorKind::UnexpectedToken(t)),
} }
} }

View file

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

View file

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

View file

@ -209,9 +209,7 @@ impl<'source> Parser<'source> {
| Token::EqualEqual | Token::EqualEqual
| Token::NotEqual | Token::NotEqual
| Token::LessThan | Token::LessThan
| Token::GreaterThan | Token::GreaterThan => Ok(Expr::new(
| Token::And
| Token::Or => Ok(Expr::new(
self.binop_flow( self.binop_flow(
BinOpKind::from_token(token).map_err(|e| Error::new(e, self.lexer.span()))?, BinOpKind::from_token(token).map_err(|e| Error::new(e, self.lexer.span()))?,
buf, 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 { impl Display for Value {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {