#![allow(dead_code)] use crate::ast::Expr; use crate::lexer::Token; use crate::lexer::TokenKind; pub fn token(kind: TokenKind, value: &str) -> Token { Token { kind, value: value.into(), span: (0, 0), } } pub fn literal(value: &str) -> Box { Box::new(Expr::Literal(value.into())) } pub fn var(identifier: &str) -> Box { Box::new(Expr::Var(identifier.into())) } pub fn binary(left: Box, op: TokenKind, right: Box) -> Box { Box::new(Expr::Binary(left, op, right)) } pub fn unary(op: TokenKind, expr: Box) -> Box { Box::new(Expr::Unary(op, expr)) } pub fn group(expr: Box) -> Box { Box::new(Expr::Group(expr)) }