Fix empty documents tests.
This commit is contained in:
parent
e7f29450ca
commit
6308bbe98f
2 changed files with 5 additions and 8 deletions
|
@ -3,6 +3,7 @@ use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Debug, Eq)]
|
#[derive(Clone, Copy, PartialEq, Debug, Eq)]
|
||||||
enum State {
|
enum State {
|
||||||
|
/// We await the start of the stream.
|
||||||
StreamStart,
|
StreamStart,
|
||||||
ImplicitDocumentStart,
|
ImplicitDocumentStart,
|
||||||
DocumentStart,
|
DocumentStart,
|
||||||
|
@ -265,6 +266,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
||||||
.expect("fetch_token needs to be preceded by peek_token")
|
.expect("fetch_token needs to be preceded by peek_token")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Skip the next token from the scanner.
|
||||||
fn skip(&mut self) {
|
fn skip(&mut self) {
|
||||||
self.token = None;
|
self.token = None;
|
||||||
//self.peek_token();
|
//self.peek_token();
|
||||||
|
@ -407,7 +409,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn state_machine(&mut self) -> ParseResult {
|
fn state_machine(&mut self) -> ParseResult {
|
||||||
// let next_tok = self.peek_token()?;
|
// let next_tok = self.peek_token().cloned()?;
|
||||||
// println!("cur_state {:?}, next tok: {:?}", self.state, next_tok);
|
// println!("cur_state {:?}, next tok: {:?}", self.state, next_tok);
|
||||||
match self.state {
|
match self.state {
|
||||||
State::StreamStart => self.stream_start(),
|
State::StreamStart => self.stream_start(),
|
||||||
|
@ -458,10 +460,8 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn document_start(&mut self, implicit: bool) -> ParseResult {
|
fn document_start(&mut self, implicit: bool) -> ParseResult {
|
||||||
if !implicit {
|
while let TokenType::DocumentEnd = self.peek_token()?.1 {
|
||||||
while let TokenType::DocumentEnd = self.peek_token()?.1 {
|
self.skip();
|
||||||
self.skip();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match *self.peek_token()? {
|
match *self.peek_token()? {
|
||||||
|
|
|
@ -297,9 +297,6 @@ fn expected_events(expected_tree: &str) -> Vec<String> {
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
static EXPECTED_FAILURES: &[&str] = &[
|
static EXPECTED_FAILURES: &[&str] = &[
|
||||||
// Document with no nodes and document end
|
|
||||||
"HWV9",
|
|
||||||
"QT73",
|
|
||||||
// Unusual characters in anchors/aliases
|
// Unusual characters in anchors/aliases
|
||||||
"8XYN", // emoji!!
|
"8XYN", // emoji!!
|
||||||
"W5VH", // :@*!$"<foo>:
|
"W5VH", // :@*!$"<foo>:
|
||||||
|
|
Loading…
Reference in a new issue