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 {
|
fn document_end(&mut self) -> ParseResult {
|
||||||
|
let mut explicit_end = false;
|
||||||
let marker: Marker = match *self.peek_token()? {
|
let marker: Marker = match *self.peek_token()? {
|
||||||
Token(mark, TokenType::DocumentEnd) => {
|
Token(mark, TokenType::DocumentEnd) => {
|
||||||
|
explicit_end = true;
|
||||||
self.skip();
|
self.skip();
|
||||||
mark
|
mark
|
||||||
}
|
}
|
||||||
|
@ -564,7 +566,11 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.tags.clear();
|
self.tags.clear();
|
||||||
|
if explicit_end {
|
||||||
|
self.state = State::ImplicitDocumentStart;
|
||||||
|
} else {
|
||||||
self.state = State::DocumentStart;
|
self.state = State::DocumentStart;
|
||||||
|
}
|
||||||
Ok((Event::DocumentEnd, marker))
|
Ok((Event::DocumentEnd, marker))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,6 @@ fn expected_events(expected_tree: &str) -> Vec<String> {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
static EXPECTED_FAILURES: &[&str] = &[
|
static EXPECTED_FAILURES: &[&str] = &[
|
||||||
// Bare document after end marker
|
// Bare document after end marker
|
||||||
"7Z25",
|
|
||||||
"M7A3",
|
"M7A3",
|
||||||
// Scalar marker on document start line
|
// Scalar marker on document start line
|
||||||
"DK3J",
|
"DK3J",
|
||||||
|
|
Loading…
Reference in a new issue