mirror of
https://gitlab.cs.washington.edu/fidelp/frustration.git
synced 2024-12-26 21:58:20 +01:00
better error handling, + "ok" in interpret mode only
This commit is contained in:
parent
0b11491963
commit
182c374117
1 changed files with 12 additions and 2 deletions
|
@ -144,7 +144,10 @@ fn create_d(c: &mut Core) {
|
||||||
create(c, short_name);
|
create(c, short_name);
|
||||||
c.post = Post::EatWord;
|
c.post = Post::EatWord;
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {
|
||||||
|
println!(" create needs an argument");
|
||||||
|
c.post = Post::WarmReset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,6 +459,7 @@ fn outer(c: &mut Core, s: &str) {
|
||||||
Post::WarmReset => {
|
Post::WarmReset => {
|
||||||
c.tds = 0;
|
c.tds = 0;
|
||||||
c.trs = 0;
|
c.trs = 0;
|
||||||
|
c.state = State::Interpreting;
|
||||||
break; // discard rest of input line
|
break; // discard rest of input line
|
||||||
}
|
}
|
||||||
Post::Nothing => { }
|
Post::Nothing => { }
|
||||||
|
@ -468,7 +472,13 @@ fn main() {
|
||||||
loop {
|
loop {
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
match io::stdin().read_line(&mut buf) {
|
match io::stdin().read_line(&mut buf) {
|
||||||
Ok(_) => { outer(&mut c, &buf); println!(" ok");}
|
Ok(_) => {
|
||||||
|
outer(&mut c, &buf);
|
||||||
|
match c.state {
|
||||||
|
State::Interpreting => {println!(" ok")}
|
||||||
|
State::Compiling => {}
|
||||||
|
};
|
||||||
|
}
|
||||||
Err(_) => { break; }
|
Err(_) => { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue