devour dangling whitespace before checking for EOF

This commit is contained in:
Mark Thom
2019-09-29 10:05:40 -06:00
parent 5ec4dfedb0
commit e8bac464d0
2 changed files with 5 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "scryer-prolog"
version = "0.8.95"
version = "0.8.96"
authors = ["Mark Thom <markjordanthom@gmail.com>"]
build = "build.rs"
repository = "https://github.com/mthom/scryer-prolog"
@@ -16,7 +16,7 @@ dirs = "2.0.2"
downcast = "0.10.0"
indexmap = "1.0.2"
ordered-float = "0.5.0"
prolog_parser = "0.8.29"
prolog_parser = "0.8.30"
ref_thread_local = "0.0.0"
rug = "1.4.0"
rustyline = "5.0.3"

View File

@@ -173,6 +173,7 @@ impl<'a, R: Read> TermStream<'a, R> {
#[inline]
pub fn eof(&mut self) -> Result<bool, ParserError> {
self.parser.devour_whitespace()?; // eliminate dangling comments before checking for EOF.
Ok(self.stack.is_empty() && self.parser.eof()?)
}
@@ -251,11 +252,13 @@ impl<'a, R: Read> TermStream<'a, R> {
}
self.parser.reset();
let term = self.parser.read_term(composite_op!(
self.in_module,
&self.wam.indices.op_dir,
op_dir
))?;
self.stack.push(term);
}
}