summaryrefslogtreecommitdiff
path: root/valexpr.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-24 02:11:32 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-24 02:11:32 -0400
commit1fd37a432d060a08254ecb1a9129050563075140 (patch)
treef80ee5bf2b780f315348c2767150b9643e9d9488 /valexpr.cc
parent73e2abd1b2e2bacbd353999a7b3edd95a04112c4 (diff)
downloadfork-ledger-1fd37a432d060a08254ecb1a9129050563075140.tar.gz
fork-ledger-1fd37a432d060a08254ecb1a9129050563075140.tar.bz2
fork-ledger-1fd37a432d060a08254ecb1a9129050563075140.zip
cleanup; fully switched to autoconf -- use scripts/acprep
Diffstat (limited to 'valexpr.cc')
-rw-r--r--valexpr.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/valexpr.cc b/valexpr.cc
index 64a0a0f9..6dcdb454 100644
--- a/valexpr.cc
+++ b/valexpr.cc
@@ -370,21 +370,21 @@ inline value_expr_t * parse_value_term(const char * p) {
value_expr_t * parse_value_term(std::istream& in)
{
+ static char buf[256];
+
std::auto_ptr<value_expr_t> node;
char c = peek_next_nonws(in);
if (std::isdigit(c)) {
- static char buf[2048];
- READ_INTO(in, buf, 2048, c, std::isdigit(c));
+ READ_INTO(in, buf, 255, c, std::isdigit(c));
node.reset(new value_expr_t(value_expr_t::CONSTANT_I));
node->constant_i = std::atol(buf);
return node.release();
}
else if (c == '{') {
- static char buf[2048];
in.get(c);
- READ_INTO(in, buf, 2048, c, c != '}');
+ READ_INTO(in, buf, 255, c, c != '}');
if (c == '}')
in.get(c);
else
@@ -488,8 +488,7 @@ value_expr_t * parse_value_term(std::istream& in)
}
}
- static char buf[4096];
- READ_INTO(in, buf, 4096, c, c != '/');
+ READ_INTO(in, buf, 255, c, c != '/');
if (c != '/')
throw value_expr_error("Missing closing '/'");
@@ -511,15 +510,16 @@ value_expr_t * parse_value_term(std::istream& in)
break;
case '[': {
- static char buf[1024];
- READ_INTO(in, buf, 1024, c, c != ']');
+ READ_INTO(in, buf, 255, c, c != ']');
if (c != ']')
throw value_expr_error("Missing ']'");
-
in.get(c);
+
node.reset(new value_expr_t(value_expr_t::CONSTANT_T));
- if (! parse_date(buf, &node->constant_t))
- throw value_expr_error("Failed to parse date");
+
+ std::string datespec = buf;
+ std::istringstream stream(datespec);
+ interval_t::parse(stream, &node->constant_t, NULL);
break;
}