normalize inputs via shell

This commit is contained in:
Aidan Hahn 2021-09-18 17:02:40 -07:00
parent 72598c2168
commit a8e2484212
No known key found for this signature in database
GPG key ID: 327711E983899316

View file

@ -51,12 +51,21 @@ fn main() {
} }
loop { loop {
// todo: configurable prompt // TODO: configurable prompt
let readline = rl.readline("λ "); let readline = rl.readline("λ ");
match readline { match readline {
Ok(line) => { Ok(line) => {
rl.add_history_entry(line.as_str()); rl.add_history_entry(line.as_str());
match lex(line.as_str().to_owned()) { let mut l = line.as_str().to_owned();
if !l.starts_with("(") {
l = "(".to_owned() + &l;
}
if !l.ends_with(")") {
l = l + ")";
}
match lex(l) {
Ok(a) => { Ok(a) => {
match eval(a.clone(), vt.clone(), ft.clone(), false) { match eval(a.clone(), vt.clone(), ft.clone(), false) {
Ok(a) => { Ok(a) => {