Removed ! for ain't

pull/7/head
ondra05 2022-04-08 17:39:14 +02:00
parent 96f2db4dc6
commit 4c20ef179e
4 changed files with 7 additions and 7 deletions

View File

@ -152,7 +152,7 @@ pub enum Expr {
rhs: Box<Spanned<Expr>>,
kind: BinOpKind,
},
Not(Box<Spanned<Expr>>),
Aint(Box<Spanned<Expr>>),
Literal(Value),
Cart(Vec<(Spanned<Expr>, Spanned<Expr>)>),
Index {

View File

@ -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

View File

@ -59,8 +59,8 @@ pub enum Token {
#[token("!=")]
NotEqual,
#[regex("!|ain't")]
Not,
#[token("ain't")]
Aint,
// Keywords
#[token("functio")]

View File

@ -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,
)),