From 7d1fa94d0d10cdad5a9bd2eed8c824cecd557aa3 Mon Sep 17 00:00:00 2001 From: Yuheng Chen Date: Tue, 26 May 2015 16:41:35 +0800 Subject: [PATCH] Add multidoc support --- parser/src/parser.rs | 70 +++++++++++- parser/tests/spec_test.rs | 10 +- parser/tests/spec_test.rs.inc | 194 +++++++++++++++++----------------- 3 files changed, 169 insertions(+), 105 deletions(-) diff --git a/parser/src/parser.rs b/parser/src/parser.rs index 3e2b069..8fa31f4 100644 --- a/parser/src/parser.rs +++ b/parser/src/parser.rs @@ -98,7 +98,7 @@ impl> Parser { pub fn parse(&mut self) -> ParseResult { if self.scanner.stream_ended() || self.state == State::End { - return Ok(Event::NoEvent); + return Ok(Event::StreamEnd); } let ev = self.state_machine(); println!("EV {:?}", ev); @@ -112,6 +112,7 @@ impl> Parser { } if self.scanner.stream_ended() { + // XXX has parsed? return Ok(Yaml::Null); } let ev = try!(self.parse()); @@ -121,11 +122,37 @@ impl> Parser { self.load_document(&ev) } + pub fn load_multidoc(&mut self) -> Result, ScanError> { + if !self.scanner.stream_started() { + let ev = try!(self.parse()); + assert_eq!(ev, Event::StreamStart); + } + + if self.scanner.stream_ended() { + // XXX has parsed? + return Ok(Vec::new()); + } + let mut docs: Vec = Vec::new(); + loop { + let ev = try!(self.parse()); + if ev == Event::StreamEnd { + return Ok(docs); + } + docs.push(try!(self.load_document(&ev))); + } + unreachable!(); + } + fn load_document(&mut self, first_ev: &Event) -> Result { assert_eq!(first_ev, &Event::DocumentStart); let ev = try!(self.parse()); - self.load_node(&ev) + let doc = try!(self.load_node(&ev)); + // DOCUMENT-END is expected. + let ev = try!(self.parse()); + assert_eq!(ev, Event::DocumentEnd); + + Ok(doc) } fn load_node(&mut self, first_ev: &Event) -> Result { @@ -193,9 +220,11 @@ impl> Parser { println!("cur_state {:?}, next tok: {:?}", self.state, next_tok); match self.state { State::StreamStart => self.stream_start(), + State::ImplicitDocumentStart => self.document_start(true), State::DocumentStart => self.document_start(false), State::DocumentContent => self.document_content(), + State::DocumentEnd => self.document_end(), State::BlockNode => self.parse_node(true, false), State::BlockNodeOrIndentlessSequence => self.parse_node(true, true), @@ -296,6 +325,24 @@ impl> Parser { } } + fn document_end(&mut self) -> ParseResult { + let mut _implicit = true; + let tok = try!(self.peek()); + let _start_mark = tok.0; + + match tok.1 { + TokenType::DocumentEndToken => { + self.skip(); + _implicit = false; + } + _ => {} + } + + // TODO tag handling + self.state = State::DocumentStart; + Ok(Event::DocumentEnd) + } + fn parse_node(&mut self, block: bool, indentless_sequence: bool) -> ParseResult { let tok = try!(self.peek()); match tok.1 { @@ -495,8 +542,23 @@ a7: 你好 ".to_string(); let mut parser = Parser::new(s.chars()); let out = parser.load().unwrap(); - println!("DOC {:?}", out); - println!("DOC {}", out["a7"].as_str().unwrap()); + assert_eq!(out["a7"].as_str().unwrap(), "你好"); + } + + #[test] + fn test_multi_doc() { + let s = +" +'a scalar' +--- +'a scalar' +--- +'a scalar' +"; + let mut p = Parser::new(s.chars()); + let out = p.load_multidoc().unwrap(); + assert_eq!(out.len(), 3); + } } diff --git a/parser/tests/spec_test.rs b/parser/tests/spec_test.rs index 7c481b4..cd9f1c1 100644 --- a/parser/tests/spec_test.rs +++ b/parser/tests/spec_test.rs @@ -18,7 +18,7 @@ enum TestEvent { OnNull, } -fn yaml_to_test_events(root :&Yaml) -> Vec { +fn yaml_to_test_events(docs: &Vec) -> Vec { fn next(root: &Yaml, evs: &mut Vec) { match *root { Yaml::BadValue => { panic!("unexpected BadValue"); }, @@ -42,9 +42,11 @@ fn yaml_to_test_events(root :&Yaml) -> Vec { } } let mut evs: Vec = Vec::new(); - evs.push(TestEvent::OnDocumentStart); - next(&root, &mut evs); - evs.push(TestEvent::OnDocumentEnd); + for doc in docs { + evs.push(TestEvent::OnDocumentStart); + next(doc, &mut evs); + evs.push(TestEvent::OnDocumentEnd); + } evs } diff --git a/parser/tests/spec_test.rs.inc b/parser/tests/spec_test.rs.inc index e9a68c7..3282454 100644 --- a/parser/tests/spec_test.rs.inc +++ b/parser/tests/spec_test.rs.inc @@ -1,7 +1,7 @@ #[test] fn test_ex2_1_seq_scalars() { let mut p = Parser::new(EX2_1.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -14,7 +14,7 @@ fn test_ex2_1_seq_scalars() { #[test] fn test_ex2_2_mapping_scalars_to_scalars() { let mut p = Parser::new(EX2_2.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -30,7 +30,7 @@ fn test_ex2_2_mapping_scalars_to_scalars() { #[test] fn test_ex2_3_mapping_scalars_to_sequences() { let mut p = Parser::new(EX2_3.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -52,7 +52,7 @@ fn test_ex2_3_mapping_scalars_to_sequences() { #[test] fn test_ex2_4_sequence_of_mappings() { let mut p = Parser::new(EX2_4.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -78,7 +78,7 @@ fn test_ex2_4_sequence_of_mappings() { #[test] fn test_ex2_5_sequence_of_sequences() { let mut p = Parser::new(EX2_5.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnSequenceStart); @@ -103,7 +103,7 @@ fn test_ex2_5_sequence_of_sequences() { #[test] fn test_ex2_6_mapping_of_mappings() { let mut p = Parser::new(EX2_6.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -127,7 +127,7 @@ fn test_ex2_6_mapping_of_mappings() { #[test] fn test_ex2_7_two_documents_in_a_stream() { let mut p = Parser::new(EX2_7.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -146,7 +146,7 @@ fn test_ex2_7_two_documents_in_a_stream() { #[test] fn test_ex2_8_play_by_play_feed() { let mut p = Parser::new(EX2_8.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -172,7 +172,7 @@ fn test_ex2_8_play_by_play_feed() { #[test] fn test_ex2_9_single_document_with_two_comments() { let mut p = Parser::new(EX2_9.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -192,7 +192,7 @@ fn test_ex2_9_single_document_with_two_comments() { #[test] fn test_ex2_10_simple_anchor() { let mut p = Parser::new(EX2_10.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -212,7 +212,7 @@ fn test_ex2_10_simple_anchor() { #[test] fn test_ex2_11_mapping_between_sequences() { let mut p = Parser::new(EX2_11.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnSequenceStart); @@ -238,7 +238,7 @@ fn test_ex2_11_mapping_between_sequences() { #[test] fn test_ex2_12_compact_nested_mapping() { let mut p = Parser::new(EX2_12.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -266,7 +266,7 @@ fn test_ex2_12_compact_nested_mapping() { #[test] fn test_ex2_13_in_literals_newlines_are_preserved() { let mut p = Parser::new(EX2_13.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -275,7 +275,7 @@ fn test_ex2_13_in_literals_newlines_are_preserved() { #[test] fn test_ex2_14_in_folded_scalars_newlines_become_spaces() { let mut p = Parser::new(EX2_14.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -284,7 +284,7 @@ fn test_ex2_14_in_folded_scalars_newlines_become_spaces() { #[test] fn test_ex2_15_folded_newlines_are_preserved_for_more_indented_and_blank_lines() { let mut p = Parser::new(EX2_15.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -293,7 +293,7 @@ fn test_ex2_15_folded_newlines_are_preserved_for_more_indented_and_blank_lines() #[test] fn test_ex2_16_indentation_determines_scope() { let mut p = Parser::new(EX2_16.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -309,7 +309,7 @@ fn test_ex2_16_indentation_determines_scope() { #[test] fn test_ex2_17_quoted_scalars() { let mut p = Parser::new(EX2_17.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -331,7 +331,7 @@ fn test_ex2_17_quoted_scalars() { #[test] fn test_ex2_18_multi_line_flow_scalars() { let mut p = Parser::new(EX2_18.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -345,7 +345,7 @@ fn test_ex2_18_multi_line_flow_scalars() { #[test] fn test_ex2_23_various_explicit_tags() { let mut p = Parser::new(EX2_23.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -361,7 +361,7 @@ fn test_ex2_23_various_explicit_tags() { #[test] fn test_ex2_24_global_tags() { let mut p = Parser::new(EX2_24.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -401,7 +401,7 @@ fn test_ex2_24_global_tags() { #[test] fn test_ex2_25_unordered_sets() { let mut p = Parser::new(EX2_25.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -417,7 +417,7 @@ fn test_ex2_25_unordered_sets() { #[test] fn test_ex2_26_ordered_mappings() { let mut p = Parser::new(EX2_26.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -439,7 +439,7 @@ fn test_ex2_26_ordered_mappings() { #[test] fn test_ex2_27_invoice() { let mut p = Parser::new(EX2_27.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -502,7 +502,7 @@ fn test_ex2_27_invoice() { #[test] fn test_ex2_28_log_file() { let mut p = Parser::new(EX2_28.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -557,7 +557,7 @@ fn test_ex2_28_log_file() { #[test] fn test_ex5_3_block_structure_indicators() { let mut p = Parser::new(EX5_3.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -579,7 +579,7 @@ fn test_ex5_3_block_structure_indicators() { #[test] fn test_ex5_4_flow_structure_indicators() { let mut p = Parser::new(EX5_4.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -601,7 +601,7 @@ fn test_ex5_4_flow_structure_indicators() { #[test] fn test_ex5_6_node_property_indicators() { let mut p = Parser::new(EX5_6.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -615,7 +615,7 @@ fn test_ex5_6_node_property_indicators() { #[test] fn test_ex5_7_block_scalar_indicators() { let mut p = Parser::new(EX5_7.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -629,7 +629,7 @@ fn test_ex5_7_block_scalar_indicators() { #[test] fn test_ex5_8_quoted_scalar_indicators() { let mut p = Parser::new(EX5_8.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -643,7 +643,7 @@ fn test_ex5_8_quoted_scalar_indicators() { #[test] fn test_ex5_11_line_break_characters() { let mut p = Parser::new(EX5_11.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -652,7 +652,7 @@ fn test_ex5_11_line_break_characters() { #[test] fn test_ex5_12_tabs_and_spaces() { let mut p = Parser::new(EX5_12.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -666,7 +666,7 @@ fn test_ex5_12_tabs_and_spaces() { #[test] fn test_ex5_13_escaped_characters() { let mut p = Parser::new(EX5_13.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -675,7 +675,7 @@ fn test_ex5_13_escaped_characters() { #[test] fn test_ex6_1_indentation_spaces() { let mut p = Parser::new(EX6_1.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -696,7 +696,7 @@ fn test_ex6_1_indentation_spaces() { #[test] fn test_ex6_2_indentation_indicators() { let mut p = Parser::new(EX6_2.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -714,7 +714,7 @@ fn test_ex6_2_indentation_indicators() { #[test] fn test_ex6_3_separation_spaces() { let mut p = Parser::new(EX6_3.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -732,7 +732,7 @@ fn test_ex6_3_separation_spaces() { #[test] fn test_ex6_4_line_prefixes() { let mut p = Parser::new(EX6_4.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -748,7 +748,7 @@ fn test_ex6_4_line_prefixes() { #[test] fn test_ex6_5_empty_lines() { let mut p = Parser::new(EX6_5.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -762,7 +762,7 @@ fn test_ex6_5_empty_lines() { #[test] fn test_ex6_6_line_folding() { let mut p = Parser::new(EX6_6.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -771,7 +771,7 @@ fn test_ex6_6_line_folding() { #[test] fn test_ex6_7_block_folding() { let mut p = Parser::new(EX6_7.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -780,7 +780,7 @@ fn test_ex6_7_block_folding() { #[test] fn test_ex6_8_flow_folding() { let mut p = Parser::new(EX6_8.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -789,7 +789,7 @@ fn test_ex6_8_flow_folding() { #[test] fn test_ex6_9_separated_comment() { let mut p = Parser::new(EX6_9.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -801,7 +801,7 @@ fn test_ex6_9_separated_comment() { #[test] fn test_ex6_12_separation_spaces_ii() { let mut p = Parser::new(EX6_12.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnMapStart); @@ -823,7 +823,7 @@ fn test_ex6_12_separation_spaces_ii() { #[test] fn test_ex6_13_reserved_directives() { let mut p = Parser::new(EX6_13.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -832,7 +832,7 @@ fn test_ex6_13_reserved_directives() { #[test] fn test_ex6_14_yaml_directive() { let mut p = Parser::new(EX6_14.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -841,7 +841,7 @@ fn test_ex6_14_yaml_directive() { #[test] fn test_ex6_16_tag_directive() { let mut p = Parser::new(EX6_16.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -850,7 +850,7 @@ fn test_ex6_16_tag_directive() { #[test] fn test_ex6_18_primary_tag_handle() { let mut p = Parser::new(EX6_18.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -862,7 +862,7 @@ fn test_ex6_18_primary_tag_handle() { #[test] fn test_ex6_19_secondary_tag_handle() { let mut p = Parser::new(EX6_19.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -871,7 +871,7 @@ fn test_ex6_19_secondary_tag_handle() { #[test] fn test_ex6_20_tag_handles() { let mut p = Parser::new(EX6_20.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -880,7 +880,7 @@ fn test_ex6_20_tag_handles() { #[test] fn test_ex6_21_local_tag_prefix() { let mut p = Parser::new(EX6_21.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -892,7 +892,7 @@ fn test_ex6_21_local_tag_prefix() { #[test] fn test_ex6_22_global_tag_prefix() { let mut p = Parser::new(EX6_22.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -903,7 +903,7 @@ fn test_ex6_22_global_tag_prefix() { #[test] fn test_ex6_23_node_properties() { let mut p = Parser::new(EX6_23.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -917,7 +917,7 @@ fn test_ex6_23_node_properties() { #[test] fn test_ex6_24_verbatim_tags() { let mut p = Parser::new(EX6_24.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -929,7 +929,7 @@ fn test_ex6_24_verbatim_tags() { #[test] fn test_ex6_26_tag_shorthands() { let mut p = Parser::new(EX6_26.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -942,7 +942,7 @@ fn test_ex6_26_tag_shorthands() { #[test] fn test_ex6_28_non_specific_tags() { let mut p = Parser::new(EX6_28.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -955,7 +955,7 @@ fn test_ex6_28_non_specific_tags() { #[test] fn test_ex6_29_node_anchors() { let mut p = Parser::new(EX6_29.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -969,7 +969,7 @@ fn test_ex6_29_node_anchors() { #[test] fn test_ex7_1_alias_nodes() { let mut p = Parser::new(EX7_1.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -987,7 +987,7 @@ fn test_ex7_1_alias_nodes() { #[test] fn test_ex7_2_empty_nodes() { let mut p = Parser::new(EX7_2.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1001,7 +1001,7 @@ fn test_ex7_2_empty_nodes() { #[test] fn test_ex7_3_completely_empty_nodes() { let mut p = Parser::new(EX7_3.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1015,7 +1015,7 @@ fn test_ex7_3_completely_empty_nodes() { #[test] fn test_ex7_4_double_quoted_implicit_keys() { let mut p = Parser::new(EX7_4.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1032,7 +1032,7 @@ fn test_ex7_4_double_quoted_implicit_keys() { #[test] fn test_ex7_5_double_quoted_line_breaks() { let mut p = Parser::new(EX7_5.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1041,7 +1041,7 @@ fn test_ex7_5_double_quoted_line_breaks() { #[test] fn test_ex7_6_double_quoted_lines() { let mut p = Parser::new(EX7_6.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1050,7 +1050,7 @@ fn test_ex7_6_double_quoted_lines() { #[test] fn test_ex7_7_single_quoted_characters() { let mut p = Parser::new(EX7_7.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1059,7 +1059,7 @@ fn test_ex7_7_single_quoted_characters() { #[test] fn test_ex7_8_single_quoted_implicit_keys() { let mut p = Parser::new(EX7_8.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1076,7 +1076,7 @@ fn test_ex7_8_single_quoted_implicit_keys() { #[test] fn test_ex7_9_single_quoted_lines() { let mut p = Parser::new(EX7_9.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1085,7 +1085,7 @@ fn test_ex7_9_single_quoted_lines() { #[test] fn test_ex7_10_plain_characters() { let mut p = Parser::new(EX7_10.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -1107,7 +1107,7 @@ fn test_ex7_10_plain_characters() { #[test] fn test_ex7_11_plain_implicit_keys() { let mut p = Parser::new(EX7_11.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1124,7 +1124,7 @@ fn test_ex7_11_plain_implicit_keys() { #[test] fn test_ex7_12_plain_lines() { let mut p = Parser::new(EX7_12.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1133,7 +1133,7 @@ fn test_ex7_12_plain_lines() { #[test] fn test_ex7_13_flow_sequence() { let mut p = Parser::new(EX7_13.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnSequenceStart); @@ -1151,7 +1151,7 @@ fn test_ex7_13_flow_sequence() { #[test] fn test_ex7_14_flow_sequence_entries() { let mut p = Parser::new(EX7_14.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -1171,7 +1171,7 @@ fn test_ex7_14_flow_sequence_entries() { #[test] fn test_ex7_15_flow_mappings() { let mut p = Parser::new(EX7_15.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -1193,7 +1193,7 @@ fn test_ex7_15_flow_mappings() { #[test] fn test_ex7_16_flow_mapping_entries() { let mut p = Parser::new(EX7_16.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1209,7 +1209,7 @@ fn test_ex7_16_flow_mapping_entries() { #[test] fn test_ex7_17_flow_mapping_separate_values() { let mut p = Parser::new(EX7_17.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1227,7 +1227,7 @@ fn test_ex7_17_flow_mapping_separate_values() { #[test] fn test_ex7_18_flow_mapping_adjacent_values() { let mut p = Parser::new(EX7_18.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1243,7 +1243,7 @@ fn test_ex7_18_flow_mapping_adjacent_values() { #[test] fn test_ex7_19_single_pair_flow_mappings() { let mut p = Parser::new(EX7_19.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -1257,7 +1257,7 @@ fn test_ex7_19_single_pair_flow_mappings() { #[test] fn test_ex7_20_single_pair_explicit_entry() { let mut p = Parser::new(EX7_20.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -1271,7 +1271,7 @@ fn test_ex7_20_single_pair_explicit_entry() { #[test] fn test_ex7_21_single_pair_implicit_entries() { let mut p = Parser::new(EX7_21.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnSequenceStart); @@ -1302,7 +1302,7 @@ fn test_ex7_21_single_pair_implicit_entries() { #[test] fn test_ex7_23_flow_content() { let mut p = Parser::new(EX7_23.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnSequenceStart); @@ -1323,7 +1323,7 @@ fn test_ex7_23_flow_content() { #[test] fn test_ex7_24_flow_nodes() { let mut p = Parser::new(EX7_24.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -1338,7 +1338,7 @@ fn test_ex7_24_flow_nodes() { #[test] fn test_ex8_1_block_scalar_header() { let mut p = Parser::new(EX8_1.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -1352,7 +1352,7 @@ fn test_ex8_1_block_scalar_header() { #[test] fn test_ex8_2_block_indentation_header() { let mut p = Parser::new(EX8_2.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -1366,7 +1366,7 @@ fn test_ex8_2_block_indentation_header() { #[test] fn test_ex8_4_chomping_final_line_break() { let mut p = Parser::new(EX8_4.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1382,7 +1382,7 @@ fn test_ex8_4_chomping_final_line_break() { #[test] fn test_ex8_6_empty_scalar_chomping() { let mut p = Parser::new(EX8_6.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1398,7 +1398,7 @@ fn test_ex8_6_empty_scalar_chomping() { #[test] fn test_ex8_7_literal_scalar() { let mut p = Parser::new(EX8_7.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1407,7 +1407,7 @@ fn test_ex8_7_literal_scalar() { #[test] fn test_ex8_8_literal_content() { let mut p = Parser::new(EX8_8.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1416,7 +1416,7 @@ fn test_ex8_8_literal_content() { #[test] fn test_ex8_9_folded_scalar() { let mut p = Parser::new(EX8_9.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1425,7 +1425,7 @@ fn test_ex8_9_folded_scalar() { #[test] fn test_ex8_10_folded_lines() { let mut p = Parser::new(EX8_10.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1434,7 +1434,7 @@ fn test_ex8_10_folded_lines() { #[test] fn test_ex8_11_more_indented_lines() { let mut p = Parser::new(EX8_11.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1443,7 +1443,7 @@ fn test_ex8_11_more_indented_lines() { #[test] fn test_ex8_12_empty_separation_lines() { let mut p = Parser::new(EX8_12.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1452,7 +1452,7 @@ fn test_ex8_12_empty_separation_lines() { #[test] fn test_ex8_13_final_empty_lines() { let mut p = Parser::new(EX8_13.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnScalar); assert_next!(v, TestEvent::OnDocumentEnd); @@ -1461,7 +1461,7 @@ fn test_ex8_13_final_empty_lines() { #[test] fn test_ex8_14_block_sequence() { let mut p = Parser::new(EX8_14.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1479,7 +1479,7 @@ fn test_ex8_14_block_sequence() { #[test] fn test_ex8_15_block_sequence_entry_types() { let mut p = Parser::new(EX8_15.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnNull); @@ -1499,7 +1499,7 @@ fn test_ex8_15_block_sequence_entry_types() { #[test] fn test_ex8_16_block_mappings() { let mut p = Parser::new(EX8_16.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1514,7 +1514,7 @@ fn test_ex8_16_block_mappings() { #[test] fn test_ex8_17_explicit_block_mapping_entries() { let mut p = Parser::new(EX8_17.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1531,7 +1531,7 @@ fn test_ex8_17_explicit_block_mapping_entries() { #[test] fn test_ex8_18_implicit_block_mapping_entries() { let mut p = Parser::new(EX8_18.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar); @@ -1549,7 +1549,7 @@ fn test_ex8_18_implicit_block_mapping_entries() { #[test] fn test_ex8_19_compact_block_mappings() { let mut p = Parser::new(EX8_19.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnMapStart); @@ -1573,7 +1573,7 @@ fn test_ex8_19_compact_block_mappings() { #[test] fn test_ex8_20_block_node_types() { let mut p = Parser::new(EX8_20.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnSequenceStart); assert_next!(v, TestEvent::OnScalar); @@ -1589,7 +1589,7 @@ fn test_ex8_20_block_node_types() { #[test] fn test_ex8_22_block_collection_nodes() { let mut p = Parser::new(EX8_22.chars()); - let mut v = yaml_to_test_events(&p.load().unwrap()).into_iter(); + let mut v = yaml_to_test_events(&p.load_multidoc().unwrap()).into_iter(); assert_next!(v, TestEvent::OnDocumentStart); assert_next!(v, TestEvent::OnMapStart); assert_next!(v, TestEvent::OnScalar);