Fix Ctrl-D
@@ -122,19 +122,11 @@ fn skip_char(&mut self, c: char) {
}
pub fn eof(&mut self) -> Result<bool, ParserError> {
- if self.reader.peek_char().is_none() {
- return Ok(true);
- }
-
let mut c = is_not_eof!(self.reader, self.lookahead_char());
while layout_char!(c) {
self.skip_char(c);
- if self.reader.peek_char().is_none() {
- return Ok(true);
- }
-
c = is_not_eof!(self.reader, self.lookahead_char());
}
@@ -1051,6 +1043,10 @@ pub fn next_token(&mut self) -> Result<Token, ParserError> {
};
}
+ if c == '\u{0}' {
+ return Err(ParserError::UnexpectedEOF);
+ }
+
self.name_token(c)
}
Err(e) => Err(e),
