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:
parent
4277d3e6b4
commit
800d2ccde8
2 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,5 +38,6 @@ fn run_prompt() {
|
|||
.read_line(&mut line)
|
||||
.expect("failed to read user input");
|
||||
interpreter::run(&line);
|
||||
line.clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue