normalize inputs via shell
This commit is contained in:
parent
72598c2168
commit
a8e2484212
1 changed files with 11 additions and 2 deletions
|
|
@ -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) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue