fix(tazjin/rlox): Clear previous line in REPL mode

Change-Id: I8acc5b0d07b2c656f9bba76a6ddac6b9088ea563
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2189
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2020-11-28 16:58:46 +01:00 committed by tazjin
parent 4277d3e6b4
commit 800d2ccde8
2 changed files with 4 additions and 2 deletions

View file

@ -3,6 +3,7 @@ use crate::scanner;
// Run some Lox code and print it to stdout
pub fn run(code: &str) {
let chars: Vec<char> = code.chars().collect();
let _tokens = scanner::scan(&chars);
println!("no interpreter yet, sorry")
for token in scanner::scan(&chars) {
println!("{:?}", token);
}
}

View file

@ -38,5 +38,6 @@ fn run_prompt() {
.read_line(&mut line)
.expect("failed to read user input");
interpreter::run(&line);
line.clear();
}
}