diff options
author | John Wiegley <johnw@newartisans.com> | 2007-04-19 20:31:46 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:28 -0400 |
commit | 0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c (patch) | |
tree | 0a2c2aca7100d045f491b03f0a5bda92378d3ef9 /textual.cc | |
parent | 176b3044e355398a0c31e0c42a3cd7b8a2e3f3e5 (diff) | |
download | fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.gz fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.bz2 fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.zip |
Made the amount/balance/value interface a bit more rational; added
back a useless version of the register command (just to prove the
command sequence); and added smart XML semantics to the XPath
implementation so that nodes can be coerced to values.
Diffstat (limited to 'textual.cc')
-rw-r--r-- | textual.cc | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -229,9 +229,9 @@ transaction_t * parse_transaction(char * line, amount_t per_unit_cost(*xact->cost); if (per_unit) - *xact->cost *= xact->amount; + *xact->cost *= xact->amount.number(); else - per_unit_cost /= xact->amount; + per_unit_cost /= xact->amount.number(); if (xact->amount.commodity() && ! xact->amount.commodity().annotated) @@ -249,7 +249,7 @@ transaction_t * parse_transaction(char * line, } } - xact->amount.reduce(); + xact->amount.in_place_reduce(); DEBUG_PRINT("ledger.textual.parse", "line " << linenum << ": " << "Reduced amount is " << xact->amount); @@ -348,17 +348,14 @@ entry_t * parse_entry(std::istream& in, char * line, journal_t * journal, TIMER_START(entry_date); -#if 0 - // jww (2007-04-18): Need to write a full date parser - curr->_date.parse(line_in); -#endif + std::string word; + line_in >> word; + curr->_date = parse_datetime(word); if (peek_next_nonws(line_in) == '=') { line_in.get(c); -#if 0 - // jww (2007-04-18): Need to write a full date parser - curr->_date_eff.parse(line_in); -#endif + line_in >> word; + curr->_date_eff = parse_datetime(word); } TIMER_STOP(entry_date); @@ -750,7 +747,7 @@ unsigned int textual_parser_t::parse(std::istream& in, case '~': { // period entry period_entry_t * pe = new period_entry_t(skip_ws(line + 1)); if (! pe->period) - throw new parse_error(std::string("Parsing time period '") + line + "'"); + throw new parse_error(std::string("Parsing time period '") + skip_ws(line + 1) + "'"); if (parse_transactions(in, journal, account_stack.front(), *pe, "period", end_pos)) { |