Fix indent in block scalars.
This commit is contained in:
parent
9f4b1480df
commit
76b3773ffd
2 changed files with 11 additions and 3 deletions
|
@ -1643,8 +1643,14 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
return Ok(Token(start_mark, TokenType::Scalar(style, contents)));
|
||||
}
|
||||
|
||||
let start_mark = self.mark;
|
||||
if self.mark.col < indent && (self.mark.col as isize) > self.indent {
|
||||
return Err(ScanError::new(
|
||||
self.mark,
|
||||
"wrongly indented line in block scalar",
|
||||
));
|
||||
}
|
||||
|
||||
let start_mark = self.mark;
|
||||
while self.mark.col == indent && !is_z(self.ch()) {
|
||||
if indent == 0 {
|
||||
self.lookahead(4);
|
||||
|
@ -1817,7 +1823,10 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
}
|
||||
|
||||
if (self.mark.col as isize) < self.indent {
|
||||
return Err(ScanError::new(start_mark, "invalid identation in quoted scalar"));
|
||||
return Err(ScanError::new(
|
||||
start_mark,
|
||||
"invalid identation in quoted scalar",
|
||||
));
|
||||
}
|
||||
|
||||
leading_blanks = false;
|
||||
|
|
|
@ -315,7 +315,6 @@ fn expected_events(expected_tree: &str) -> Vec<String> {
|
|||
#[rustfmt::skip]
|
||||
static EXPECTED_FAILURES: &[&str] = &[
|
||||
// Misc
|
||||
"S98Z", // Block scalar and indent problems?
|
||||
"U99R", // Comma is not allowed in tags
|
||||
"WZ62", // Empty content
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue