From 92f2c62d59a14e4c485466b04083ad356e3f18fa Mon Sep 17 00:00:00 2001 From: Erin Date: Mon, 30 Aug 2021 22:18:09 +0200 Subject: [PATCH] Removed And and Or ops because they aren't cursed enough --- ablescript/src/ast.rs | 4 ---- ablescript/src/interpret.rs | 2 -- ablescript/src/lexer.rs | 6 ------ ablescript/src/parser.rs | 4 +--- ablescript/src/variables.rs | 16 ---------------- 5 files changed, 1 insertion(+), 31 deletions(-) diff --git a/ablescript/src/ast.rs b/ablescript/src/ast.rs index 0d68f119..61fe5230 100644 --- a/ablescript/src/ast.rs +++ b/ablescript/src/ast.rs @@ -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)), } } diff --git a/ablescript/src/interpret.rs b/ablescript/src/interpret.rs index 656583a9..21e023a5 100644 --- a/ablescript/src/interpret.rs +++ b/ablescript/src/interpret.rs @@ -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()), diff --git a/ablescript/src/lexer.rs b/ablescript/src/lexer.rs index 1ac49d66..c32d9367 100644 --- a/ablescript/src/lexer.rs +++ b/ablescript/src/lexer.rs @@ -64,12 +64,6 @@ pub enum Token { #[token("!=")] NotEqual, - #[token("&")] - And, - - #[token("|")] - Or, - #[token("!|aint")] // also add aint as a not keyword Not, diff --git a/ablescript/src/parser.rs b/ablescript/src/parser.rs index 16c6733d..e2873b07 100644 --- a/ablescript/src/parser.rs +++ b/ablescript/src/parser.rs @@ -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, diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index 4e636a3e..25b9217a 100644 --- a/ablescript/src/variables.rs +++ b/ablescript/src/variables.rs @@ -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 {