From 4153a9897344cb669c25bc6895e16ed9f3aaeaf1 Mon Sep 17 00:00:00 2001 From: Ethiraric Date: Wed, 24 Jan 2024 19:31:45 +0100 Subject: [PATCH] Pre-load chars in `skip_block_scalar_indent`. --- parser/src/scanner.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parser/src/scanner.rs b/parser/src/scanner.rs index 01fcfd4..1dcc583 100644 --- a/parser/src/scanner.rs +++ b/parser/src/scanner.rs @@ -1661,14 +1661,14 @@ impl> Scanner { /// Skip the block scalar indentation and empty lines. fn skip_block_scalar_indent(&mut self, indent: usize, breaks: &mut String) { loop { + self.lookahead(indent + 2); // Consume all spaces. Tabs cannot be used as indentation. - while self.mark.col < indent && self.look_ch() == ' ' { + while self.mark.col < indent && self.ch() == ' ' { self.skip(); } // If our current line is empty, skip over the break and continue looping. - if is_break(self.look_ch()) { - self.lookahead(2); + if is_break(self.ch()) { self.read_break(breaks); } else { // Otherwise, we have a content line. Return control.