Fix DK95-00, I guess.
This commit is contained in:
parent
f9e55be2f0
commit
326082e0bc
2 changed files with 18 additions and 9 deletions
|
@ -595,6 +595,11 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Skip over all whitespace and comments until the next token.
|
||||
///
|
||||
/// # Errors
|
||||
/// This function returns an error if a tabulation is encountered where there should not be
|
||||
/// one.
|
||||
fn skip_to_next_token(&mut self) -> ScanResult {
|
||||
loop {
|
||||
// TODO(chenyh) BOM
|
||||
|
@ -604,7 +609,10 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
// "Indentation" only exists as long as a block is started, but does not exist
|
||||
// inside of flow-style constructs. Tabs are allowed as part of leaading
|
||||
// whitespaces outside of indentation.
|
||||
'\t' if self.is_within_block() && self.leading_whitespace => {
|
||||
'\t' if self.is_within_block()
|
||||
&& self.leading_whitespace
|
||||
&& (self.mark.col as isize) < self.indent =>
|
||||
{
|
||||
return Err(ScanError::new(
|
||||
self.mark,
|
||||
"tabs disallowed within this context (block indentation)",
|
||||
|
@ -1239,18 +1247,13 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
}
|
||||
}
|
||||
|
||||
// Eat whitespaces and comments to the end of the line.
|
||||
self.lookahead(1);
|
||||
|
||||
while is_blank(self.ch()) {
|
||||
while is_blank(self.look_ch()) {
|
||||
self.skip();
|
||||
self.lookahead(1);
|
||||
}
|
||||
|
||||
if self.ch() == '#' {
|
||||
while !is_breakz(self.ch()) {
|
||||
while !is_breakz(self.look_ch()) {
|
||||
self.skip();
|
||||
self.lookahead(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1267,6 +1270,13 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
self.skip_line();
|
||||
}
|
||||
|
||||
if self.look_ch() == '\t' {
|
||||
return Err(ScanError::new(
|
||||
start_mark,
|
||||
"a block scalar content cannot start with a tab",
|
||||
));
|
||||
}
|
||||
|
||||
if increment > 0 {
|
||||
indent = if self.indent >= 0 {
|
||||
(self.indent + increment as isize) as usize
|
||||
|
|
|
@ -299,7 +299,6 @@ fn expected_events(expected_tree: &str) -> Vec<String> {
|
|||
static EXPECTED_FAILURES: &[&str] = &[
|
||||
// These seem to be plain bugs
|
||||
// TAB as start of plain scalar instead of whitespace
|
||||
"DK95-00",
|
||||
"Y79Y-06",
|
||||
"Y79Y-03", // unexpected pass
|
||||
"Y79Y-04", // unexpected pass
|
||||
|
|
Loading…
Reference in a new issue