Small fixes
This commit is contained in:
parent
a154741176
commit
6f4be5a929
|
|
@ -124,7 +124,7 @@ impl InterpreterState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stack_top(&self) -> Option<&StackValue> {
|
pub fn stack_top(&self) -> Option<&StackValue> {
|
||||||
self.stack.get(0)
|
self.stack.get(self.stack.len() - 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,8 @@ pub fn repl() -> i32 {
|
||||||
LexResult::Ok(tokens) => {
|
LexResult::Ok(tokens) => {
|
||||||
for token in tokens {
|
for token in tokens {
|
||||||
if !interpreter.execute(token) {
|
if !interpreter.execute(token) {
|
||||||
return 1;
|
println!("A runtime error occured!");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue