Skip to content

Commit

Permalink
Show parser errors in output
Browse files Browse the repository at this point in the history
  • Loading branch information
chompaa committed May 27, 2024
1 parent 3e297e8 commit 257b403
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Binary file modified playground/bun.lockb
Binary file not shown.
11 changes: 7 additions & 4 deletions playground/dom-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ pub fn interpret(contents: &str) {
);

let mut parser = Parser::new();
let program = match parser.produce_ast(contents.to_string()) {
Ok(program) => program,
Err(reason) => panic!("[L{}] {reason}", parser.line()),
match parser.produce_ast(contents.to_string()) {
Ok(program) => {
let _ = eval(program, &mut env);
}
Err(reason) => {
console::log_1(&format!("[L{}] {reason}", parser.line()).into());
}
};
let _ = eval(program, &mut env);
}

0 comments on commit 257b403

Please sign in to comment.