diff options
author | Vincent Ambo <mail@tazj.in> | 2020-12-06T17·03+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2020-12-06T17·34+0000 |
commit | 42405bfa249c3e6ec5e2b7d8fd9836b55269e68f (patch) | |
tree | f27859483b4679b91011c71c44818da83b0c0f8b /users/tazjin/rlox/src/interpreter.rs | |
parent | 1835b2be990f51f4111c847aa8ad3c8477191eba (diff) |
feat(tazjin/rlox): Synchronise parser state after errors r/1991
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
Diffstat (limited to 'users/tazjin/rlox/src/interpreter.rs')
-rw-r--r-- | users/tazjin/rlox/src/interpreter.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/users/tazjin/rlox/src/interpreter.rs b/users/tazjin/rlox/src/interpreter.rs index 8a4d5cfef0df..7c5a18dd9ac9 100644 --- a/users/tazjin/rlox/src/interpreter.rs +++ b/users/tazjin/rlox/src/interpreter.rs @@ -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), |