chore(tazjin/rlox): Set up some scaffolding for panic mode

This lets us suppress reporting of additional errors from the compiler
until a synchronisation point is reached.

Change-Id: Iacf90949f868fbdb4349750065b5e458cf74d32a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2557
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2021-02-27 15:45:44 +02:00 committed by tazjin
parent ee974b3edd
commit b13a6736dd
2 changed files with 26 additions and 6 deletions

View file

@ -20,7 +20,10 @@ impl crate::Lox for Interpreter {
Interpreter {}
}
fn interpret(&mut self, code: String) -> Result<Self::Value, Vec<Self::Error>> {
fn interpret(
&mut self,
code: String,
) -> Result<Self::Value, Vec<Self::Error>> {
let chunk = compiler::compile(&code)?;
vm::interpret(chunk).map_err(|e| vec![e])
}