Pre-load chars in skip_block_scalar_indent.

This commit is contained in:
Ethiraric 2024-01-24 19:31:45 +01:00
parent 980d5b0335
commit 4153a98973

View file

@ -1661,14 +1661,14 @@ impl<T: Iterator<Item = char>> Scanner<T> {
/// Skip the block scalar indentation and empty lines. /// Skip the block scalar indentation and empty lines.
fn skip_block_scalar_indent(&mut self, indent: usize, breaks: &mut String) { fn skip_block_scalar_indent(&mut self, indent: usize, breaks: &mut String) {
loop { loop {
self.lookahead(indent + 2);
// Consume all spaces. Tabs cannot be used as indentation. // 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(); self.skip();
} }
// If our current line is empty, skip over the break and continue looping. // If our current line is empty, skip over the break and continue looping.
if is_break(self.look_ch()) { if is_break(self.ch()) {
self.lookahead(2);
self.read_break(breaks); self.read_break(breaks);
} else { } else {
// Otherwise, we have a content line. Return control. // Otherwise, we have a content line. Return control.