refine EOF handling more (#1873)

This commit is contained in:
Mark
2023-07-09 01:53:40 -06:00
parent b8a6882a27
commit c8b9059289
4 changed files with 25 additions and 39 deletions

View File

@@ -620,30 +620,6 @@ impl<'a, R: CharRead> Parser<'a, R> {
false
}
pub fn devour_whitespace(&mut self) -> Result<(), ParserError> {
match self.lexer.lookahead_char() {
Err(e) => { // if e.is_unexpected_eof() => {
return Err(e);
}
Ok(c) => {
let mut layout_info = LayoutInfo { inserted: false, more: true };
let mut cr = Some(c);
loop {
self.lexer.consume_layout(cr, &mut layout_info)?;
if !layout_info.more {
break;
}
cr = self.lexer.lookahead_char().ok();
}
}
}
Ok(())
}
pub fn reset(&mut self) {
self.stack.clear()
}