switch to miette for error reporting

This commit is contained in:
Robin Appelman 2021-08-29 20:30:35 +02:00
commit 097ed69b9e
9 changed files with 387 additions and 316 deletions

View file

@ -1,6 +1,7 @@
use miette::DiagnosticResult;
use php_literal_parser::{from_str, Value};
fn main() {
fn main() -> DiagnosticResult<()> {
let source = r###"
array (
"double" => "quote",
@ -17,8 +18,6 @@ fn main() {
)
"###;
match from_str::<Value>(source) {
Ok(result) => print!("{:#?}", result),
Err(err) => eprint!("{}", err.with_source(source)),
}
println!("{:#?}", from_str::<Value>(source)?);
Ok(())
}