summaryrefslogtreecommitdiff
path: root/src/token.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-05-14 21:37:36 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-05-14 21:41:38 -0600
commit96172669053bbba7263a370f109f70615049a0c6 (patch)
treee3e0a0d6bb7bec06505965da4e845e12bbc63971 /src/token.cc
parent32eaa0346959188a030cd217ec02b02040efeb26 (diff)
downloadfork-ledger-96172669053bbba7263a370f109f70615049a0c6.tar.gz
fork-ledger-96172669053bbba7263a370f109f70615049a0c6.tar.bz2
fork-ledger-96172669053bbba7263a370f109f70615049a0c6.zip
Improved detection of iostream's eof() condition
Diffstat (limited to 'src/token.cc')
-rw-r--r--src/token.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/token.cc b/src/token.cc
index afe48b08..1392c29f 100644
--- a/src/token.cc
+++ b/src/token.cc
@@ -148,7 +148,7 @@ void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags)
char c = peek_next_nonws(in);
- if (in.eof()) {
+ if (in.eof() || c == -1) {
kind = TOK_EOF;
return;
}
@@ -426,6 +426,8 @@ void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags)
expected('\0', c);
parse_ident(in);
+ } else {
+ throw_(parse_error, _("Unexpected EOF"));
}
if (! value.is_string() || value.as_string().empty()) {