Commit 182c3741 authored by psf's avatar psf
Browse files

better error handling, + "ok" in interpret mode only

parent 0b114919
......@@ -144,7 +144,10 @@ fn create_d(c: &mut Core) {
create(c, short_name);
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 => {
c.tds = 0;
c.trs = 0;
c.state = State::Interpreting;
break; // discard rest of input line
}
Post::Nothing => { }
......@@ -468,7 +472,13 @@ fn main() {
loop {
let mut buf = String::new();
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; }
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment