feat(tazjin/rlox): Synchronise parser state after errors
This lets the parser collect multiple errors instead of returning after the first one, with some optimistic synchronisation after encountering something that looks wonky. Change-Id: Ie9d0ce8de9dcc7a3d1e7aa2abe15f74cab0ab96b Reviewed-on: https://cl.tvl.fyi/c/depot/+/2236 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
This commit is contained in:
parent
1835b2be99
commit
42405bfa24
3 changed files with 67 additions and 10 deletions
|
|
@ -11,7 +11,7 @@ pub fn run(code: &str) {
|
|||
print_tokens(&tokens);
|
||||
match parser::parse(tokens) {
|
||||
Ok(expr) => println!("Expression:\n{:?}", expr),
|
||||
Err(error) => report_errors(vec![error]),
|
||||
Err(errors) => report_errors(errors),
|
||||
}
|
||||
}
|
||||
Err(errors) => report_errors(errors),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue