Fix towards multiple documents in a single stream.

This commit is contained in:
Ethiraric 2024-01-18 19:16:17 +01:00
parent 1606523193
commit 0a1aebaf3c
2 changed files with 7 additions and 2 deletions

View file

@ -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))
}

View file

@ -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",