From ec1b8200e053a93ab1f90b63c4b488cc382ba208 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 8 Apr 2022 17:39:14 +0200 Subject: [PATCH] Removed ! for ain't --- ablescript/src/ast.rs | 2 +- ablescript/src/interpret.rs | 2 +- ablescript/src/lexer.rs | 4 ++-- ablescript/src/parser.rs | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ablescript/src/ast.rs b/ablescript/src/ast.rs index de68ed93..68778427 100644 --- a/ablescript/src/ast.rs +++ b/ablescript/src/ast.rs @@ -152,7 +152,7 @@ pub enum Expr { rhs: Box>, kind: BinOpKind, }, - Not(Box>), + Aint(Box>), Literal(Value), Cart(Vec<(Spanned, Spanned)>), Index { diff --git a/ablescript/src/interpret.rs b/ablescript/src/interpret.rs index aa2a41ab..3f91052b 100644 --- a/ablescript/src/interpret.rs +++ b/ablescript/src/interpret.rs @@ -174,7 +174,7 @@ impl ExecEnv { NotEqual => Value::Abool((lhs != rhs).into()), } } - Not(expr) => !self.eval_expr(expr)?, + Aint(expr) => !self.eval_expr(expr)?, Literal(value) => value.clone(), Expr::Cart(members) => Value::Cart( members diff --git a/ablescript/src/lexer.rs b/ablescript/src/lexer.rs index cbd5a22a..e2d4fea6 100644 --- a/ablescript/src/lexer.rs +++ b/ablescript/src/lexer.rs @@ -59,8 +59,8 @@ pub enum Token { #[token("!=")] NotEqual, - #[regex("!|ain't")] - Not, + #[token("ain't")] + Aint, // Keywords #[token("functio")] diff --git a/ablescript/src/parser.rs b/ablescript/src/parser.rs index 7b200aee..144514fd 100644 --- a/ablescript/src/parser.rs +++ b/ablescript/src/parser.rs @@ -103,7 +103,7 @@ impl<'source> Parser<'source> { Token::Identifier(_) | Token::String(_) | Token::Integer(_) - | Token::Not + | Token::Aint | Token::LeftBracket | Token::LeftParen => Ok(Spanned::new( self.value_flow(token)?, @@ -213,10 +213,10 @@ impl<'source> Parser<'source> { start..self.lexer.span().end, )), - Token::Not => Ok(Spanned::new( + Token::Aint => Ok(Spanned::new( { let next = self.checked_next()?; - Expr::Not(Box::new(self.parse_expr(next, buf)?)) + Expr::Aint(Box::new(self.parse_expr(next, buf)?)) }, start..self.lexer.span().end, )),