Fix duplicate version directive.
This commit is contained in:
parent
7b744d092e
commit
ff28b55d22
2 changed files with 6 additions and 2 deletions
|
@ -498,15 +498,20 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
|||
}
|
||||
|
||||
fn parser_process_directives(&mut self) -> Result<(), ScanError> {
|
||||
let mut version_directive_received = false;
|
||||
loop {
|
||||
let mut tags = HashMap::new();
|
||||
match self.peek_token()? {
|
||||
Token(_, TokenType::VersionDirective(_, _)) => {
|
||||
Token(mark, TokenType::VersionDirective(_, _)) => {
|
||||
// XXX parsing with warning according to spec
|
||||
//if major != 1 || minor > 2 {
|
||||
// return Err(ScanError::new(tok.0,
|
||||
// "found incompatible YAML document"));
|
||||
//}
|
||||
if version_directive_received == true {
|
||||
return Err(ScanError::new(*mark, "duplicate version directive"));
|
||||
}
|
||||
version_directive_received = true;
|
||||
}
|
||||
Token(mark, TokenType::TagDirective(handle, prefix)) => {
|
||||
if tags.contains_key(handle) {
|
||||
|
|
|
@ -298,7 +298,6 @@ fn expected_events(expected_tree: &str) -> Vec<String> {
|
|||
#[rustfmt::skip]
|
||||
static EXPECTED_FAILURES: &[&str] = &[
|
||||
// Directives (various)
|
||||
"SF5V", // duplicate directive
|
||||
"W4TN", // scalar confused as directive
|
||||
// Losing trailing newline
|
||||
"JEF9-02",
|
||||
|
|
Loading…
Reference in a new issue