summaryrefslogtreecommitdiff
path: root/src/expr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr.cc')
-rw-r--r--src/expr.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/expr.cc b/src/expr.cc
index 8fed2b14..f3a30de6 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -46,14 +46,19 @@ void expr_t::parse(std::istream& in, const parse_flags_t& flags,
if (original_string) {
set_text(*original_string);
- } else {
+ }
+ else if (end_pos > start_pos) {
in.clear();
in.seekg(start_pos, std::ios::beg);
scoped_array<char> buf
(new char[static_cast<std::size_t>(end_pos - start_pos) + 1]);
in.read(buf.get(), end_pos - start_pos);
+ buf[end_pos - start_pos] = '\0';
set_text(buf.get());
}
+ else {
+ set_text("<stream>");
+ }
}
void expr_t::compile(scope_t& scope)