Fixes towards implicit document end.
This commit is contained in:
parent
f27a7c25a8
commit
7b744d092e
2 changed files with 11 additions and 4 deletions
|
@ -271,9 +271,11 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
|||
self.token = None;
|
||||
//self.peek_token();
|
||||
}
|
||||
/// Pops the top-most state and make it the current state.
|
||||
fn pop_state(&mut self) {
|
||||
self.state = self.states.pop().unwrap();
|
||||
}
|
||||
/// Push a new state atop the state stack.
|
||||
fn push_state(&mut self, state: State) {
|
||||
self.states.push(state);
|
||||
}
|
||||
|
@ -569,8 +571,17 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
|||
if explicit_end {
|
||||
self.state = State::ImplicitDocumentStart;
|
||||
} else {
|
||||
if let Token(mark, TokenType::VersionDirective(..) | TokenType::TagDirective(..)) =
|
||||
*self.peek_token()?
|
||||
{
|
||||
return Err(ScanError::new(
|
||||
mark,
|
||||
"missing explicit document end marker before directive",
|
||||
));
|
||||
}
|
||||
self.state = State::DocumentStart;
|
||||
}
|
||||
|
||||
Ok((Event::DocumentEnd, marker))
|
||||
}
|
||||
|
||||
|
|
|
@ -298,10 +298,6 @@ fn expected_events(expected_tree: &str) -> Vec<String> {
|
|||
#[rustfmt::skip]
|
||||
static EXPECTED_FAILURES: &[&str] = &[
|
||||
// Directives (various)
|
||||
"9HCY", // Directive after content
|
||||
"EB22", // Directive after content
|
||||
"MUS6-01", // no document end marker?
|
||||
"RHX7", // no document end marker
|
||||
"SF5V", // duplicate directive
|
||||
"W4TN", // scalar confused as directive
|
||||
// Losing trailing newline
|
||||
|
|
Loading…
Reference in a new issue