parent
a99c7b3a9d
commit
ff90a2127c
2 changed files with 11 additions and 3 deletions
|
@ -58,8 +58,8 @@ impl Event {
|
|||
Event::Scalar("~".to_owned(), TScalarStyle::Plain, 0, None)
|
||||
}
|
||||
|
||||
fn empty_scalar_with_anchor(anchor: usize, tag: TokenType) -> Event {
|
||||
Event::Scalar("".to_owned(), TScalarStyle::Plain, anchor, Some(tag))
|
||||
fn empty_scalar_with_anchor(anchor: usize, tag: Option<TokenType>) -> Event {
|
||||
Event::Scalar("".to_owned(), TScalarStyle::Plain, anchor, tag)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ impl<T: Iterator<Item=char>> Parser<T> {
|
|||
// ex 7.2, an empty scalar can follow a secondary tag
|
||||
_ if tag.is_some() || anchor_id > 0 => {
|
||||
self.pop_state();
|
||||
Ok(Event::empty_scalar_with_anchor(anchor_id, tag.unwrap()))
|
||||
Ok(Event::empty_scalar_with_anchor(anchor_id, tag))
|
||||
},
|
||||
_ => { Err(ScanError::new(tok.0, "while parsing a node, did not find expected node content")) }
|
||||
}
|
||||
|
|
|
@ -404,6 +404,14 @@ a1: &DEFAULT
|
|||
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_github_27() {
|
||||
// https://github.com/chyh1990/yaml-rust/issues/27
|
||||
let s = "&a";
|
||||
let out = YamlLoader::load_from_str(&s).unwrap();
|
||||
let doc = &out[0];
|
||||
assert_eq!(doc.as_str().unwrap(), "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_plain_datatype() {
|
||||
|
|
Loading…
Reference in a new issue