Main program - Reset REPL buffer before reading

This commit is contained in:
Emmanuel BENOîT 2022-12-30 18:38:40 +01:00
parent 6fad0fdfc4
commit 4e9e566a4f

View file

@ -30,6 +30,7 @@ fn run_prompt() {
loop { loop {
print!("slox> "); print!("slox> ");
stdout.flush().unwrap(); stdout.flush().unwrap();
buffer.clear();
let n_read = stdin let n_read = stdin
.read_line(&mut buffer) .read_line(&mut buffer)
.expect("Failed to read from stdin"); .expect("Failed to read from stdin");