From 29b513bea3f1ffa1857b409642d4bad55239dd3f Mon Sep 17 00:00:00 2001 From: Ethiraric Date: Thu, 21 Dec 2023 00:13:53 +0100 Subject: [PATCH] More fixes towards tabulations. --- saphyr/src/scanner.rs | 6 ++---- saphyr/tests/yaml-test-suite.rs | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/saphyr/src/scanner.rs b/saphyr/src/scanner.rs index 3fdd98d..2cda77c 100644 --- a/saphyr/src/scanner.rs +++ b/saphyr/src/scanner.rs @@ -1585,7 +1585,7 @@ impl> Scanner { let mut leading_break = String::new(); let mut trailing_breaks = String::new(); let mut whitespaces = String::new(); - let mut leading_blanks = false; + let mut leading_blanks = true; loop { /* Check for a document indicator. */ @@ -1647,9 +1647,8 @@ impl> Scanner { if !(is_blank(self.ch()) || is_break(self.ch())) { break; } - self.lookahead(1); - while is_blank(self.ch()) || is_break(self.ch()) { + while is_blank(self.look_ch()) || is_break(self.ch()) { if is_blank(self.ch()) { if leading_blanks && (self.mark.col as isize) < indent && self.ch() == '\t' { return Err(ScanError::new( @@ -1673,7 +1672,6 @@ impl> Scanner { leading_blanks = true; } } - self.lookahead(1); } // check indentation level diff --git a/saphyr/tests/yaml-test-suite.rs b/saphyr/tests/yaml-test-suite.rs index a4e1419..c9e9372 100644 --- a/saphyr/tests/yaml-test-suite.rs +++ b/saphyr/tests/yaml-test-suite.rs @@ -299,16 +299,13 @@ fn expected_events(expected_tree: &str) -> Vec { static EXPECTED_FAILURES: &[&str] = &[ // These seem to be plain bugs // TAB as start of plain scalar instead of whitespace - "6BCT", "6CA3", - "A2M4", "DK95-00", "Q5MG", "Y79Y-06", "Y79Y-03", // unexpected pass "Y79Y-04", // unexpected pass "Y79Y-05", // unexpected pass - "Y79Y-10", // TABs in whitespace-only lines "DK95-03", "DK95-04",