Fix towards multiple documents in a single stream.
This commit is contained in:
parent
bff3c4ccaf
commit
b2aa95b4c1
2 changed files with 7 additions and 2 deletions
|
@ -555,8 +555,10 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
|||
}
|
||||
|
||||
fn document_end(&mut self) -> ParseResult {
|
||||
let mut explicit_end = false;
|
||||
let marker: Marker = match *self.peek_token()? {
|
||||
Token(mark, TokenType::DocumentEnd) => {
|
||||
explicit_end = true;
|
||||
self.skip();
|
||||
mark
|
||||
}
|
||||
|
@ -564,7 +566,11 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
|||
};
|
||||
|
||||
self.tags.clear();
|
||||
self.state = State::DocumentStart;
|
||||
if explicit_end {
|
||||
self.state = State::ImplicitDocumentStart;
|
||||
} else {
|
||||
self.state = State::DocumentStart;
|
||||
}
|
||||
Ok((Event::DocumentEnd, marker))
|
||||
}
|
||||
|
||||
|
|
|
@ -298,7 +298,6 @@ fn expected_events(expected_tree: &str) -> Vec<String> {
|
|||
#[rustfmt::skip]
|
||||
static EXPECTED_FAILURES: &[&str] = &[
|
||||
// Bare document after end marker
|
||||
"7Z25",
|
||||
"M7A3",
|
||||
// Scalar marker on document start line
|
||||
"DK3J",
|
||||
|
|
Loading…
Reference in a new issue