aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Sanderson <zofrex@gmail.com>2016-05-19 01:12:58 +0100
committerJames Sanderson <zofrex@gmail.com>2016-05-19 01:12:58 +0100
commitdd7e31ea5351780e284a80598a66094f32b51b1d (patch)
treecafadb721d29374bdf56eef908e0229ab0a91398
parent112adaaa3fcf612fb107db311a47cdbb5bef93dc (diff)
downloadmilf-rs-dd7e31ea5351780e284a80598a66094f32b51b1d.tar.gz
milf-rs-dd7e31ea5351780e284a80598a66094f32b51b1d.zip
Refactor checking for EOF into method
-rw-r--r--src/parser.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 31205c8..08f032d 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -243,6 +243,11 @@ impl<'a> Parser<'a> {
}
}
+ // Match EOF
+ fn eof(&self) -> bool {
+ self.peek(0).is_none()
+ }
+
/// Executes the parser, parsing the string contained within.
///
/// This function will return the `TomlTable` instance if parsing is
@@ -285,7 +290,7 @@ impl<'a> Parser<'a> {
};
if self.require_newline_after_table {
self.ws();
- if !self.comment() && !self.newline() && self.peek(0).is_some() {
+ if !self.comment() && !self.newline() && !self.eof() {
self.errors.push(ParserError {
lo: start,
hi: start,