summaryrefslogtreecommitdiff
path: root/src/token.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/token.cc')
-rw-r--r--src/token.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/token.cc b/src/token.cc
index 64a5e9f9..7bfaf162 100644
--- a/src/token.cc
+++ b/src/token.cc
@@ -439,6 +439,13 @@ void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags,
unexpected(expecting);
}
} else {
+ if (! in.good()) {
+ in.clear();
+ in.seekg(0, std::ios::end);
+ if (in.fail())
+ throw_(parse_error, _("Failed to reset input stream"));
+ }
+
kind = VALUE;
value = temp;
length = static_cast<std::size_t>(in.tellg() - pos);