parser debugging utilities + fixed paren sometimes producing unbalanced events

parser events now have a `from` field which has the source location of where the event was emitted.
this location is pretty-printed when using `Debug`
This commit is contained in:
りき萌 2024-09-01 09:35:26 +02:00
parent c5b2eb376f
commit 084012d65f
7 changed files with 116 additions and 58 deletions

View file

@ -18,7 +18,10 @@ fn parse(s: &str, f: fn(&mut Parser)) -> (Ast, NodeId) {
f(&mut parser);
if !parser.diagnostics.is_empty() {
panic!("parser emitted diagnostics: {:#?}", parser.diagnostics);
panic!(
"parser: {parser:#?}\nemitted diagnostics: {:#?}",
parser.diagnostics
);
}
let mut ast = Ast::new(1024);