Open xnuk opened 2 years ago
yaml-rust parses empty scalar as ~:
yaml-rust
~
use yaml_rust::parser::{Event, EventReceiver, Parser}; struct Printer; impl EventReceiver for Printer { fn on_event(&mut self, ev: Event) { println!("{:?}", ev); } } let text: &str = r#" foo: bar: ~ "# Parser::new(text.chars()).load(&mut Recv, false)?; /* output: StreamStart DocumentStart MappingStart(0) Scalar("foo", Plain, 0, None) Scalar("~", Plain, 0, None) Scalar("bar", Plain, 0, None) Scalar("~", Plain, 0, None) MappingEnd DocumentEnd */
while libyaml's yaml_parser_parse does not (I did FFI by myself):
libyaml
yaml_parser_parse
StreamStart DocumentStart MappingStart { anchor: None } Scalar { anchor: None, value: "foo" } Scalar { anchor: None, value: "" } Scalar { anchor: None, value: "bar" } Scalar { anchor: None, value: "~" } MappingEnd DocumentEnd StreamEnd
Note: tag:yaml.org,2002:null is not in Failsafe schema^failsafe (and is in JSON schema^json).
tag:yaml.org,2002:null
Made test case for this: #183
yaml-rust
parses empty scalar as~
:while
libyaml
'syaml_parser_parse
does not (I did FFI by myself):Note:
tag:yaml.org,2002:null
is not in Failsafe schema^failsafe (and is in JSON schema^json).