handle empty arrays and trailing commas

This commit is contained in:
Robin Appelman 2020-12-01 22:20:28 +01:00
commit 36b75790f0
4 changed files with 51 additions and 21 deletions

23
examples/parse.rs Normal file
View file

@ -0,0 +1,23 @@
use php_object_parser::parse;
fn main() {
let source = r###"
array (
"double" => "quote",
'single' => 'quote',
"escaped" => "\"quote\"",
1 => 2,
"nested" => [
"sub" => "key",
],
"array" => [1,2,3,4],
"bool" => false,
"negative" => -1,
)
"###;
match parse(source) {
Ok(result) => print!("{:#?}", result),
Err(err) => eprint!("{}", err),
}
}