use ast::{Decl, PrintStyle};
use cst::{Decl as CstDecl, Expr};
use eval::Evaluator;
#[derive(Clone, Debug, PartialEq)]
pub enum ReplCommand {
Decl(CstDecl),
Evaluator(fn(Vec<Decl<()>>) -> Box<Evaluator>),
Expr(Expr),
Help,
List,
PrintStyle(PrintStyle),
Quit,
Reset,
Typeof(Expr),
}
impl ReplCommand {
pub fn help() -> &'static str {
r"<expr> Evaluates an expression
:decl <decl> Adds a declaration
:l Lists all declarations
:list Lists all declarations
:t <expr> Prints the type of an expression
:cbn Switches to call-by-name evaluation
:cbv Switches to call-by-value evaluation
:lazy Switches to lazy evaluation
:ast Switches to AST print style
:cst Switches to CST print style
:help Prints this help message
:q Quits the REPL
:quit Quits the REPL
:reset Removes all decls from the REPL"
}
}