summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xacprep22
-rw-r--r--lisp/ldg-texi.el20
-rwxr-xr-xpython/demo.py4
-rw-r--r--src/account.cc4
-rw-r--r--src/commodity.cc10
-rw-r--r--src/filters.cc54
-rw-r--r--src/format.cc155
-rw-r--r--src/global.cc2
-rw-r--r--src/item.cc20
-rw-r--r--src/item.h14
-rw-r--r--src/journal.cc10
-rw-r--r--src/journal.h6
-rw-r--r--src/op.cc6
-rw-r--r--src/post.cc12
-rw-r--r--src/precmd.cc2
-rw-r--r--src/report.cc4
-rw-r--r--src/report.h10
-rw-r--r--src/scope.cc2
-rw-r--r--src/scope.h16
-rw-r--r--src/session.cc55
-rw-r--r--src/session.h8
-rw-r--r--src/textual.cc65
-rw-r--r--src/times.cc159
-rw-r--r--src/times.h68
-rw-r--r--src/xact.cc23
-rw-r--r--src/xact.h6
-rwxr-xr-xtest/RegressTests.py11
-rw-r--r--test/baseline/opt-abbrev-len.test4
-rw-r--r--test/baseline/opt-account.test4
-rw-r--r--test/baseline/opt-amount-width.test4
-rw-r--r--test/baseline/opt-amount.test4
-rw-r--r--test/baseline/opt-collapse-if-zero.test4
-rw-r--r--test/baseline/opt-columns.test4
-rw-r--r--test/baseline/opt-commodity-as-account.test4
-rw-r--r--test/baseline/opt-commodity-as-payee.test4
-rw-r--r--test/baseline/opt-date-format.test4
-rw-r--r--test/baseline/opt-date-width.test4
-rw-r--r--test/baseline/opt-empty.test4
-rw-r--r--test/baseline/opt-forecast-while.test74
-rw-r--r--test/baseline/opt-gain.test12
-rw-r--r--test/baseline/opt-input-date-format.test4
-rw-r--r--test/baseline/opt-invert.test4
-rw-r--r--test/baseline/opt-market.test14
-rw-r--r--test/baseline/opt-output.test4
-rw-r--r--test/baseline/opt-pager.test4
-rw-r--r--test/baseline/opt-payee-as-account.test10
-rw-r--r--test/baseline/opt-payee-width.test4
-rw-r--r--test/baseline/opt-payee.test4
-rw-r--r--test/baseline/opt-quantity.test4
-rw-r--r--test/baseline/opt-revalued.test14
-rw-r--r--test/baseline/opt-sort-all.test28
-rw-r--r--test/baseline/opt-sort-xacts.test76
-rw-r--r--test/baseline/opt-sort.test166
-rw-r--r--test/baseline/opt-subtotal.test4
-rw-r--r--test/baseline/opt-total-width.test4
-rw-r--r--test/baseline/opt-total.test4
-rw-r--r--test/regress/04C5E1CA.test4
-rw-r--r--test/regress/727B2DF8.test6
-rw-r--r--test/regress/86D2BDC4.test2
-rw-r--r--test/regress/D943AE0F.test2
-rw-r--r--test/regress/E4C9A8EA.test12
-rw-r--r--test/regress/E627C594.test2
-rw-r--r--tools/Makefile.am4
-rwxr-xr-xtools/speed-test.sh18
64 files changed, 785 insertions, 511 deletions
diff --git a/acprep b/acprep
index 2f15e81c..7426cab3 100755
--- a/acprep
+++ b/acprep
@@ -357,7 +357,7 @@ class CommandLineApp(object):
exit_code = self.handleMainException()
if self.options.debug:
raise
-
+
if self.force_exit:
sys.exit(exit_code)
return exit_code
@@ -376,6 +376,7 @@ class PrepareBuild(CommandLineApp):
self.current_ver = None
#self.current_flavor = 'default'
self.current_flavor = 'debug'
+ self.prefix_dir = None
self.products_dir = None
self.build_dir = self.source_dir
self.configure_args = ['--with-included-gettext', '--enable-python']
@@ -502,6 +503,9 @@ class PrepareBuild(CommandLineApp):
op.add_option('', '--pic', action="callback",
callback=self.option_pic,
help='Compile with explicit PIC support')
+ op.add_option('', '--prefix', metavar='DIR', action="callback",
+ callback=self.option_prefix, type="string",
+ help='Use custom installation prefix')
op.add_option('', '--products', metavar='DIR', action="callback",
callback=self.option_products,
help='Collect all build products in this directory')
@@ -584,6 +588,12 @@ class PrepareBuild(CommandLineApp):
# Determine information about the surroundings #
#########################################################################
+ def prefix_directory(self):
+ if self.prefix_dir:
+ return self.prefix_dir
+ else:
+ return None
+
def default_products_directory(self):
if self.envvars['LEDGER_PRODUCTS']:
return self.envvars['LEDGER_PRODUCTS']
@@ -665,6 +675,8 @@ class PrepareBuild(CommandLineApp):
self.log.info("Source directory => " + self.source_dir)
self.log.info("Need to run autogen.sh => " +
str(self.need_to_prepare_autotools()))
+ if self.prefix_directory():
+ self.log.info("Installation prefix => " + self.prefix_directory())
self.log.info("Products directory => " + self.products_directory())
self.log.info("Build directory => " + self.build_directory())
self.log.info("Need to run configure => " +
@@ -1163,6 +1175,10 @@ class PrepareBuild(CommandLineApp):
self.log.debug('Saw option --output')
self.build_dir = value
+ def option_prefix(self, option=None, opt_str=None, value=None, parser=None):
+ self.log.debug('Saw option --prefix')
+ self.prefix_dir = value
+
def option_products(self, option=None, opt_str=None, value=None, parser=None):
self.log.debug('Saw option --products')
self.products_dir = value
@@ -1320,6 +1336,9 @@ class PrepareBuild(CommandLineApp):
conf_args.append('--with-boost-suffix=%s' %
self.boost_info.get_suffix())
+ if self.prefix_directory():
+ conf_args.append('--prefix=%s' % self.prefix_directory())
+
return (environ, conf_args + self.configure_args)
def need_to_run_configure(self):
@@ -1514,6 +1533,7 @@ class PrepareBuild(CommandLineApp):
self.build_dir = None # use the build/ tree
self.current_flavor = flavor
self.option_release()
+ self.prefix_dir = None
if reset and exists(self.build_directory()) and \
isdir(self.build_directory()):
diff --git a/lisp/ldg-texi.el b/lisp/ldg-texi.el
index 9d5383eb..b0334099 100644
--- a/lisp/ldg-texi.el
+++ b/lisp/ldg-texi.el
@@ -2,6 +2,26 @@
(defvar ledger-sample-doc-path "/Users/johnw/src/ledger/doc/sample.dat")
(defvar ledger-normalization-args "--args-only --columns 80")
+(defun ledger-update-test ()
+ (interactive)
+ (goto-char (point-min))
+ (let ((command (buffer-substring (point-min) (line-end-position)))
+ input)
+ (re-search-forward "^<<<\n")
+ (let ((beg (point)) end)
+ (re-search-forward "^>>>")
+ (setq end (match-beginning 0))
+ (forward-line 1)
+ (let ((output-beg (point)))
+ (re-search-forward "^>>>")
+ (goto-char (match-beginning 0))
+ (delete-region output-beg (point))
+ (apply #'call-process-region
+ beg end (expand-file-name "~/Products/ledger/debug/ledger")
+ nil t nil
+ "-f" "-" "--args-only" "--columns=80" "--no-color"
+ (split-string command " "))))))
+
(defun ledger-texi-write-test (name command input output &optional category)
(let ((buf (current-buffer)))
(with-current-buffer (find-file-noselect
diff --git a/python/demo.py b/python/demo.py
index 7b4003f3..88931b17 100755
--- a/python/demo.py
+++ b/python/demo.py
@@ -67,8 +67,8 @@ assert not 'CAD' in comms
# want all amounts to default to the European-style, set the static variable
# `european_by_default'.
-eur.add_flags(ledger.COMMODITY_STYLE_EUROPEAN)
-assert eur.has_flags(ledger.COMMODITY_STYLE_EUROPEAN)
+eur.add_flags(ledger.COMMODITY_STYLE_DECIMAL_COMMA)
+assert eur.has_flags(ledger.COMMODITY_STYLE_DECIMAL_COMMA)
assert not eur.has_flags(ledger.COMMODITY_STYLE_THOUSANDS)
comms.european_by_default = True
diff --git a/src/account.cc b/src/account.cc
index 809b6e46..ceeb1c12 100644
--- a/src/account.cc
+++ b/src/account.cc
@@ -295,7 +295,7 @@ namespace {
foreach (post_t * p, account.posts) {
bind_scope_t bound_scope(args, *p);
- if (expr->calc(bound_scope).to_boolean())
+ if (expr->calc(bound_scope, args.locus, args.depth).to_boolean())
return true;
}
return false;
@@ -308,7 +308,7 @@ namespace {
foreach (post_t * p, account.posts) {
bind_scope_t bound_scope(args, *p);
- if (! expr->calc(bound_scope).to_boolean())
+ if (! expr->calc(bound_scope, args.locus, args.depth).to_boolean())
return false;
}
return true;
diff --git a/src/commodity.cc b/src/commodity.cc
index 230113e8..179bbc05 100644
--- a/src/commodity.cc
+++ b/src/commodity.cc
@@ -646,9 +646,13 @@ void commodity_t::print(std::ostream& out, bool elide_quotes) const
{
string sym = symbol();
if (elide_quotes && has_flags(COMMODITY_STYLE_SEPARATED) &&
- ! sym.empty() && sym[0] == '"' && ! std::strchr(sym.c_str(), ' ')) {
- DEBUG("foo", "contracting " << sym << " to " << string(sym, 1, sym.length() - 2));
- out << string(sym, 1, sym.length() - 2);
+ ! sym.empty() && sym[0] == '"' &&
+ ! std::strchr(sym.c_str(), ' ')) {
+ string subsym(sym, 1, sym.length() - 2);
+ if (! all(subsym, is_digit()))
+ out << subsym;
+ else
+ out << sym;
} else
out << sym;
}
diff --git a/src/filters.cc b/src/filters.cc
index 86386f58..69183991 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -501,26 +501,15 @@ void related_posts::flush()
{
if (posts.size() > 0) {
foreach (post_t * post, posts) {
- if (post->xact) {
- foreach (post_t * r_post, post->xact->posts) {
- post_t::xdata_t& xdata(r_post->xdata());
- if (! xdata.has_flags(POST_EXT_HANDLED) &&
- (! xdata.has_flags(POST_EXT_RECEIVED) ?
- ! r_post->has_flags(ITEM_GENERATED | POST_VIRTUAL) :
- also_matching)) {
- xdata.add_flags(POST_EXT_HANDLED);
- item_handler<post_t>::operator()(*r_post);
- }
- }
- } else {
- // This code should only be reachable from the "output"
- // command, since that is the only command which attempts to
- // output auto or period xacts.
- post_t::xdata_t& xdata(post->xdata());
+ assert(post->xact);
+ foreach (post_t * r_post, post->xact->posts) {
+ post_t::xdata_t& xdata(r_post->xdata());
if (! xdata.has_flags(POST_EXT_HANDLED) &&
- ! post->has_flags(ITEM_GENERATED)) {
+ (! xdata.has_flags(POST_EXT_RECEIVED) ?
+ ! r_post->has_flags(ITEM_GENERATED | POST_VIRTUAL) :
+ also_matching)) {
xdata.add_flags(POST_EXT_HANDLED);
- item_handler<post_t>::operator()(*post);
+ item_handler<post_t>::operator()(*r_post);
}
}
}
@@ -1228,18 +1217,16 @@ void budget_posts::operator()(post_t& post)
void forecast_posts::add_post(const date_interval_t& period, post_t& post)
{
- generate_posts::add_post(period, post);
+ date_interval_t i(period);
+ if (! i.start && ! i.find_period(CURRENT_DATE()))
+ return;
- // Advance the period's interval until it is at or beyond the current date.
- date_interval_t& i = pending_posts.back().first;
- if (! i.start) {
- if (! i.find_period(CURRENT_DATE()))
- throw_(std::runtime_error, _("Something odd has happened"));
+ generate_posts::add_post(i, post);
+
+ // Advance the period's interval until it is at or beyond the current
+ // date.
+ while (*i.start < CURRENT_DATE())
++i;
- } else {
- while (*i.start < CURRENT_DATE())
- ++i;
- }
}
void forecast_posts::flush()
@@ -1281,6 +1268,8 @@ void forecast_posts::flush()
for (pending_posts_list::iterator i = ++pending_posts.begin();
i != pending_posts.end();
i++) {
+ assert((*i).first.start);
+ assert((*least).first.start);
if (*(*i).first.start < *(*least).first.start)
least = i;
}
@@ -1307,7 +1296,6 @@ void forecast_posts::flush()
}
begin = next;
- ++(*least).first;
// `post' refers to the posting defined in the period transaction. We
// make a copy of it within a temporary transaction with the payee
@@ -1337,6 +1325,14 @@ void forecast_posts::flush()
continue;
}
}
+
+ // Increment the 'least', but remove it from pending_posts if it
+ // exceeds its own boundaries.
+ ++(*least).first;
+ if (! (*least).first.start) {
+ pending_posts.erase(least);
+ continue;
+ }
}
item_handler<post_t>::flush();
diff --git a/src/format.cc b/src/format.cc
index ae40e1c3..946dcf80 100644
--- a/src/format.cc
+++ b/src/format.cc
@@ -432,6 +432,23 @@ string format_t::truncate(const unistring& ustr,
case ABBREVIATE:
if (account_abbrev_length > 0) {
+ // The algorithm here is complex, but aims to preserve the most
+ // information in the most useful places.
+ //
+ // Consider: You have an account name like
+ // 'Assets:Banking:Check:Register'. This account name, which is
+ // 29 characters long, must be shortened to fit in 20. How would
+ // you shorten it?
+ //
+ // The approach taken below is to compute the difference, or 9
+ // characters, and then distribute this difference semi-evenly
+ // among first three segments of the account name, by taking
+ // characters until the difference is gone. Further, earlier
+ // segments will give up more of their share of letters than later
+ // segments, since the later segments usually contain more useful
+ // information.
+
+ // First, chop up the Unicode string into individual segments.
std::list<string> parts;
string::size_type beg = 0;
string strcopy(ustr.extract());
@@ -441,34 +458,140 @@ string format_t::truncate(const unistring& ustr,
parts.push_back(string(strcopy, beg, pos - beg));
parts.push_back(string(strcopy, beg));
- std::ostringstream result;
-
- std::size_t newlen = len;
+ DEBUG("format.abbrev", "Account name: " << strcopy);
+ DEBUG("format.abbrev",
+ "Must fit a " << len << " char string in " << width << " chars");
+
+ // Figure out the lengths of all the parts. The last part is
+ // always displayed in full, while the former parts are
+ // distributed, with the latter parts being longer than the
+ // former, but with none shorter than account_abbrev_length.
+ std::list<std::size_t> lens;
+#if defined(DEBUG_ON)
+ int index = 0;
+#endif
for (std::list<string>::iterator i = parts.begin();
i != parts.end();
i++) {
- // Don't contract the last element
+ std::size_t l = unistring(*i).length();
+ DEBUG("format.abbrev",
+ "Segment " << ++index << " is " << l << " chars wide");
+ lens.push_back(l);
+ }
+
+ // Determine the "overflow", or how many chars in excess we are.
+
+ std::size_t overflow = len - width;
+ DEBUG("format.abbrev",
+ "There are " << overflow << " chars of overflow");
+
+ // Walk through the first n-1 segments, and start subtracting
+ // letters to decrease the overflow. This is done in multiple
+ // passes until the overflow is gone, or we cannot reduce any
+ // further. The calculation to find the amount to remove is:
+ //
+ // overflow * (((len(segment) + counter) * iteration) /
+ // (len(string) - len(last_segment) - counter))
+ //
+ // Where:
+ // overflow - the amount that needs to be removed
+ // counter - starts at n-1 for the first segment, then
+ // decreases by one until it reaches 0 for the
+ // last segment (which is never shortened).
+ // This value is used to weight the shrinkage
+ // so that earlier segments shrink faster.
+ // iteration - starts at 1, increase by 1 for every
+ // iteration of the loop
+ //
+ // In the example above, we have this account name:
+ //
+ // Assets:Banking:Check:Register
+ //
+ // Therefore, the amount to be removed from Assets is calculated as:
+ //
+ // 9 * (((6 + 3) * 1) / (29 - 8 - 3)) = ceil(4.5) = 5
+ //
+ // However, since removing 5 chars would make the length of the
+ // segment shorter than the default minimum of 2, we can only
+ // remove 4 chars from Assets to reduce the overflow. And on it
+ // goes.
+ //
+ // The final result will be: As:Ban:Chec:Register
+
+ std::size_t iteration = 1;
+ std::size_t len_minus_last = len - lens.back();
+ while (overflow > 0) {
+ std::size_t overflow_at_start = overflow;
+ DEBUG("format.abbrev",
+ "Overflow starting at " << overflow << " chars");
+#if defined(DEBUG_ON)
+ index = 0;
+#endif
+ std::size_t counter = lens.size();
+ for (std::list<std::size_t>::iterator i = lens.begin();
+ i != lens.end();
+ i++) {
+ if (--counter == 0 || overflow == 0)
+ break;
+ DEBUG("format.abbrev", "Overflow is " << overflow << " chars");
+ std::size_t adjust;
+ if (overflow == 1)
+ adjust = 1;
+ else
+ adjust = std::size_t
+ (std::ceil(double(overflow) *
+ ((double(*i + counter) * double(iteration)) /
+ (double(len_minus_last) - double(counter)))));
+ DEBUG("format.abbrev", "Weight calc: (" << overflow
+ << " * (((" << *i << " + " << counter << ") * "
+ << iteration << ") / (" << len_minus_last
+ << " - " << counter << ")))");
+ if (adjust == 0)
+ adjust = 1;
+ else if (adjust > overflow)
+ adjust = overflow;
+ DEBUG("format.abbrev", "The weighted part is " << adjust << " chars");
+ std::size_t slack = *i - std::min(*i, account_abbrev_length);
+ if (adjust > slack)
+ adjust = slack;
+ if (adjust > 0) {
+ DEBUG("format.abbrev",
+ "Reducing segment " << ++index << " by " << adjust << " chars");
+ (*i) -= adjust;
+ DEBUG("format.abbrev",
+ "Segment " << index << " is now " << *i << " chars wide");
+ overflow -= adjust;
+ DEBUG("format.abbrev", "Overflow is now " << overflow << " chars");
+ }
+ }
+ DEBUG("format.abbrev",
+ "Overflow ending this time at " << overflow << " chars");
+ if (overflow == overflow_at_start)
+ break;
+ iteration++;
+ }
+
+ assert(parts.size() == lens.size());
+
+ std::list<string>::iterator i = parts.begin();
+ std::list<std::size_t>::iterator l = lens.begin();
+ std::ostringstream result;
+
+ for (; i != parts.end() && l != lens.end(); i++, l++) {
std::list<string>::iterator x = i;
if (++x == parts.end()) {
result << *i;
break;
}
- if (newlen > width) {
- unistring temp(*i);
- if (temp.length() > account_abbrev_length) {
- result << temp.extract(0, account_abbrev_length) << ":";
- newlen -= temp.length() - account_abbrev_length;
- } else {
- result << temp.extract() << ":";
- newlen -= temp.length();
- }
- } else {
+ unistring temp(*i);
+ if (temp.length() > *l)
+ result << temp.extract(0, *l) << ":";
+ else
result << *i << ":";
- }
}
- if (newlen > width) {
+ if (overflow > 0) {
// Even abbreviated its too big to show the last account, so
// abbreviate all but the last and truncate at the beginning.
unistring temp(result.str());
diff --git a/src/global.cc b/src/global.cc
index eb138f25..b1466cae 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -49,6 +49,8 @@ global_scope_t::global_scope_t(char ** envp)
{
TRACE_CTOR(global_scope_t, "");
+ epoch = CURRENT_TIME();
+
#if defined(HAVE_BOOST_PYTHON)
if (! python_session.get()) {
python_session.reset(new ledger::python_interpreter_t);
diff --git a/src/item.cc b/src/item.cc
index f0273e59..63f0f3a9 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -134,10 +134,9 @@ item_t::set_tag(const string& tag,
}
}
-void item_t::parse_tags(const char * p,
- scope_t& scope,
- bool overwrite_existing,
- optional<date_t::year_type> current_year)
+void item_t::parse_tags(const char * p,
+ scope_t& scope,
+ bool overwrite_existing)
{
if (const char * b = std::strchr(p, '[')) {
if (*(b + 1) != '\0' &&
@@ -149,10 +148,10 @@ void item_t::parse_tags(const char * p,
if (char * p = std::strchr(buf, '=')) {
*p++ = '\0';
- _date_eff = parse_date(p, current_year);
+ _date_eff = parse_date(p);
}
if (buf[0])
- _date = parse_date(buf, current_year);
+ _date = parse_date(buf);
}
}
}
@@ -202,10 +201,9 @@ void item_t::parse_tags(const char * p,
}
}
-void item_t::append_note(const char * p,
- scope_t& scope,
- bool overwrite_existing,
- optional<date_t::year_type> current_year)
+void item_t::append_note(const char * p,
+ scope_t& scope,
+ bool overwrite_existing)
{
if (note) {
*note += '\n';
@@ -214,7 +212,7 @@ void item_t::append_note(const char * p,
note = p;
}
- parse_tags(p, scope, overwrite_existing, current_year);
+ parse_tags(p, scope, overwrite_existing);
}
namespace {
diff --git a/src/item.h b/src/item.h
index 209b2dc2..8018db9a 100644
--- a/src/item.h
+++ b/src/item.h
@@ -162,14 +162,12 @@ public:
const optional<value_t>& value = none,
const bool overwrite_existing = true);
- virtual void parse_tags(const char * p,
- scope_t& scope,
- bool overwrite_existing = true,
- optional<date_t::year_type> current_year = none);
- virtual void append_note(const char * p,
- scope_t& scope,
- bool overwrite_existing = true,
- optional<date_t::year_type> current_year = none);
+ virtual void parse_tags(const char * p,
+ scope_t& scope,
+ bool overwrite_existing = true);
+ virtual void append_note(const char * p,
+ scope_t& scope,
+ bool overwrite_existing = true);
static bool use_effective_date;
diff --git a/src/journal.cc b/src/journal.cc
index ed1e26be..fd6d3eac 100644
--- a/src/journal.cc
+++ b/src/journal.cc
@@ -105,8 +105,7 @@ account_t * journal_t::find_account_re(const string& regexp)
return master->find_account_re(regexp);
}
-bool journal_t::add_xact(xact_t * xact,
- optional<date_t::year_type> current_year)
+bool journal_t::add_xact(xact_t * xact)
{
xact->journal = this;
@@ -115,17 +114,16 @@ bool journal_t::add_xact(xact_t * xact,
return false;
}
- extend_xact(xact, current_year);
+ extend_xact(xact);
xacts.push_back(xact);
return true;
}
-void journal_t::extend_xact(xact_base_t * xact,
- optional<date_t::year_type> current_year)
+void journal_t::extend_xact(xact_base_t * xact)
{
foreach (auto_xact_t * auto_xact, auto_xacts)
- auto_xact->extend_xact(*xact, current_year);
+ auto_xact->extend_xact(*xact);
}
bool journal_t::remove_xact(xact_t * xact)
diff --git a/src/journal.h b/src/journal.h
index 183d074d..ca6b6e4f 100644
--- a/src/journal.h
+++ b/src/journal.h
@@ -140,10 +140,8 @@ public:
account_t * find_account(const string& name, bool auto_create = true);
account_t * find_account_re(const string& regexp);
- bool add_xact(xact_t * xact,
- optional<date_t::year_type> current_year = none);
- void extend_xact(xact_base_t * xact,
- optional<date_t::year_type> current_year = none);
+ bool add_xact(xact_t * xact);
+ void extend_xact(xact_base_t * xact);
bool remove_xact(xact_t * xact);
xacts_list::iterator xacts_begin() {
diff --git a/src/op.cc b/src/op.cc
index c2001ec3..d7588b66 100644
--- a/src/op.cc
+++ b/src/op.cc
@@ -157,7 +157,7 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth)
// Evaluating an identifier is the same as calling its definition
// directly, so we create an empty call_scope_t to reflect the scope for
// this implicit call.
- call_scope_t call_args(scope, scope.type_context(), scope.type_required());
+ call_scope_t call_args(scope, locus, depth);
result = left()->compile(call_args, depth + 1)
->calc(call_args, locus, depth + 1);
check_type_context(scope, result);
@@ -168,7 +168,7 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth)
// Evaluating a FUNCTION is the same as calling it directly; this happens
// when certain functions-that-look-like-variables (such as "amount") are
// resolved.
- call_scope_t call_args(scope, scope.type_context(), scope.type_required());
+ call_scope_t call_args(scope, locus, depth);
result = as_function()(call_args);
check_type_context(scope, result);
#if defined(DEBUG_ON)
@@ -235,7 +235,7 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth)
}
case O_CALL: {
- call_scope_t call_args(scope, scope.type_context(), scope.type_required());
+ call_scope_t call_args(scope, locus, depth);
if (has_right())
call_args.set_args(split_cons_expr(right()->kind == O_SEQ ?
right()->left() : right()));
diff --git a/src/post.cc b/src/post.cc
index bbf43227..675749fc 100644
--- a/src/post.cc
+++ b/src/post.cc
@@ -353,12 +353,14 @@ namespace {
foreach (post_t * p, post.xact->posts) {
bind_scope_t bound_scope(args, *p);
if (p == &post && args.has<expr_t::ptr_op_t>(1) &&
- ! args.get<expr_t::ptr_op_t>(1)->calc(bound_scope).to_boolean()) {
+ ! args.get<expr_t::ptr_op_t>(1)
+ ->calc(bound_scope, args.locus, args.depth).to_boolean()) {
// If the user specifies any(EXPR, false), and the context is a
// posting, then that posting isn't considered by the test.
; // skip it
}
- else if (expr->calc(bound_scope).to_boolean()) {
+ else if (expr->calc(bound_scope, args.locus,
+ args.depth).to_boolean()) {
return true;
}
}
@@ -373,12 +375,14 @@ namespace {
foreach (post_t * p, post.xact->posts) {
bind_scope_t bound_scope(args, *p);
if (p == &post && args.has<expr_t::ptr_op_t>(1) &&
- ! args.get<expr_t::ptr_op_t>(1)->calc(bound_scope).to_boolean()) {
+ ! args.get<expr_t::ptr_op_t>(1)
+ ->calc(bound_scope, args.locus, args.depth).to_boolean()) {
// If the user specifies any(EXPR, false), and the context is a
// posting, then that posting isn't considered by the test.
; // skip it
}
- else if (! expr->calc(bound_scope).to_boolean()) {
+ else if (! expr->calc(bound_scope, args.locus,
+ args.depth).to_boolean()) {
return false;
}
}
diff --git a/src/precmd.cc b/src/precmd.cc
index 4c916608..95f3e875 100644
--- a/src/precmd.cc
+++ b/src/precmd.cc
@@ -186,7 +186,7 @@ value_t period_command(call_scope_t& args)
out << std::endl;
date_interval_t interval(arg);
- interval.dump(out, report.session.current_year);
+ interval.dump(out);
return NULL_VALUE;
}
diff --git a/src/report.cc b/src/report.cc
index 6b52c52e..f7455440 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -148,8 +148,8 @@ void report_t::normalize_options(const string& verb)
if (HANDLED(period_)) {
date_interval_t interval(HANDLER(period_).str());
- optional<date_t> begin = interval.begin(session.current_year);
- optional<date_t> end = interval.end(session.current_year);
+ optional<date_t> begin = interval.begin();
+ optional<date_t> end = interval.end();
if (! HANDLED(begin_) && begin) {
string predicate = "date>=[" + to_iso_extended_string(*begin) + "]";
diff --git a/src/report.h b/src/report.h
index 44aed03b..6176c19b 100644
--- a/src/report.h
+++ b/src/report.h
@@ -393,7 +393,7 @@ public:
OPTION_(report_t, begin_, DO_(args) { // -b
date_interval_t interval(args.get<string>(1));
- optional<date_t> begin = interval.begin(parent->session.current_year);
+ optional<date_t> begin = interval.begin();
if (! begin)
throw_(std::invalid_argument,
_("Could not determine beginning of period '%1'")
@@ -543,8 +543,9 @@ public:
OPTION_(report_t, end_, DO_(args) { // -e
date_interval_t interval(args.get<string>(1));
// Use begin() here so that if the user says --end=2008, we end on
- // 2008/01/01 instead of 2009/01/01 (which is what end() would return).
- optional<date_t> end = interval.begin(parent->session.current_year);
+ // 2008/01/01 instead of 2009/01/01 (which is what end() would
+ // return).
+ optional<date_t> end = interval.begin();
if (! end)
throw_(std::invalid_argument,
_("Could not determine end of period '%1'")
@@ -665,13 +666,12 @@ public:
OPTION_(report_t, now_, DO_(args) {
date_interval_t interval(args.get<string>(1));
- optional<date_t> begin = interval.begin(parent->session.current_year);
+ optional<date_t> begin = interval.begin();
if (! begin)
throw_(std::invalid_argument,
_("Could not determine beginning of period '%1'")
<< args.get<string>(1));
ledger::epoch = parent->terminus = datetime_t(*begin);
- parent->session.current_year = ledger::epoch->date().year();
});
OPTION__
diff --git a/src/scope.cc b/src/scope.cc
index 52cf6a90..e18b5a0a 100644
--- a/src/scope.cc
+++ b/src/scope.cc
@@ -81,7 +81,7 @@ value_t& call_scope_t::resolve(const std::size_t index,
value_t& value(args[index]);
if (value.is_any()) {
context_scope_t scope(*this, context, required);
- value = as_expr(value)->calc(scope);
+ value = as_expr(value)->calc(scope, locus, depth);
if (required && ! value.is_type(context))
throw_(calc_error, _("Expected %1 for argument %2, but received %3")
<< value.label(context) << index
diff --git a/src/scope.h b/src/scope.h
index 98b0ee02..07b6bebe 100644
--- a/src/scope.h
+++ b/src/scope.h
@@ -335,11 +335,17 @@ class call_scope_t : public context_scope_t
const bool required = false);
public:
- explicit call_scope_t(scope_t& _parent,
- value_t::type_t _type_context = value_t::VOID,
- const bool _required = true)
- : context_scope_t(_parent, _type_context, _required), ptr(NULL) {
- TRACE_CTOR(call_scope_t, "scope_t&, value_t::type_t, bool");
+ expr_t::ptr_op_t * locus;
+ const int depth;
+
+ explicit call_scope_t(scope_t& _parent,
+ expr_t::ptr_op_t * _locus = NULL,
+ const int _depth = 0)
+ : context_scope_t(_parent, _parent.type_context(),
+ _parent.type_required()),
+ ptr(NULL), locus(_locus), depth(_depth) {
+ TRACE_CTOR(call_scope_t,
+ "scope_t&, value_t::type_t, bool, expr_t::ptr_op_t *, int");
}
virtual ~call_scope_t() {
TRACE_DTOR(call_scope_t);
diff --git a/src/session.cc b/src/session.cc
index df6eaf7d..85b5fab2 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -60,9 +60,7 @@ void set_session_context(session_t * session)
}
session_t::session_t()
- : flush_on_next_data_file(false),
- current_year(CURRENT_DATE().year()),
- journal(new journal_t)
+ : flush_on_next_data_file(false), journal(new journal_t)
{
TRACE_CTOR(session_t, "");
@@ -192,6 +190,40 @@ value_t session_t::fn_account(call_scope_t& args)
return NULL_VALUE;
}
+value_t session_t::fn_min(call_scope_t& args)
+{
+ return args[1] < args[0] ? args[1] : args[0];
+}
+value_t session_t::fn_max(call_scope_t& args)
+{
+ return args[1] > args[0] ? args[1] : args[0];
+}
+
+value_t session_t::fn_lot_price(call_scope_t& args)
+{
+ amount_t amt(args.get<amount_t>(1, false));
+ if (amt.has_annotation() && amt.annotation().price)
+ return *amt.annotation().price;
+ else
+ return NULL_VALUE;
+}
+value_t session_t::fn_lot_date(call_scope_t& args)
+{
+ amount_t amt(args.get<amount_t>(1, false));
+ if (amt.has_annotation() && amt.annotation().date)
+ return *amt.annotation().date;
+ else
+ return NULL_VALUE;
+}
+value_t session_t::fn_lot_tag(call_scope_t& args)
+{
+ amount_t amt(args.get<amount_t>(1, false));
+ if (amt.has_annotation() && amt.annotation().tag)
+ return string_value(*amt.annotation().tag);
+ else
+ return NULL_VALUE;
+}
+
option_t<session_t> * session_t::lookup_option(const char * p)
{
switch (*p) {
@@ -243,6 +275,23 @@ expr_t::ptr_op_t session_t::lookup(const symbol_t::kind_t kind,
if (is_eq(p, "account"))
return MAKE_FUNCTOR(session_t::fn_account);
break;
+
+ case 'l':
+ if (is_eq(p, "lot_price"))
+ return MAKE_FUNCTOR(session_t::fn_lot_price);
+ else if (is_eq(p, "lot_date"))
+ return MAKE_FUNCTOR(session_t::fn_lot_date);
+ else if (is_eq(p, "lot_tag"))
+ return MAKE_FUNCTOR(session_t::fn_lot_tag);
+ break;
+
+ case 'm':
+ if (is_eq(p, "min"))
+ return MAKE_FUNCTOR(session_t::fn_min);
+ else if (is_eq(p, "max"))
+ return MAKE_FUNCTOR(session_t::fn_max);
+ break;
+
default:
break;
}
diff --git a/src/session.h b/src/session.h
index 597268ee..6de4b2dd 100644
--- a/src/session.h
+++ b/src/session.h
@@ -56,8 +56,7 @@ class session_t : public symbol_scope_t
friend void set_session_context(session_t * session);
public:
- bool flush_on_next_data_file;
- date_t::year_type current_year;
+ bool flush_on_next_data_file;
std::auto_ptr<journal_t> journal;
explicit session_t();
@@ -75,6 +74,11 @@ public:
void close_journal_files();
value_t fn_account(call_scope_t& scope);
+ value_t fn_min(call_scope_t& scope);
+ value_t fn_max(call_scope_t& scope);
+ value_t fn_lot_price(call_scope_t& scope);
+ value_t fn_lot_date(call_scope_t& scope);
+ value_t fn_lot_tag(call_scope_t& scope);
void report_options(std::ostream& out)
{
diff --git a/src/textual.cc b/src/textual.cc
index 113bafe8..800d0c4e 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -93,18 +93,17 @@ namespace {
static const std::size_t MAX_LINE = 1024;
public:
- parse_context_t& context;
- instance_t * parent;
- accounts_map account_aliases;
- const path * original_file;
- path pathname;
- std::istream& in;
- char linebuf[MAX_LINE + 1];
- std::size_t linenum;
- istream_pos_type line_beg_pos;
- istream_pos_type curr_pos;
-
- optional<date_t::year_type> current_year;
+ parse_context_t& context;
+ instance_t * parent;
+ accounts_map account_aliases;
+ const path * original_file;
+ path pathname;
+ std::istream& in;
+ char linebuf[MAX_LINE + 1];
+ std::size_t linenum;
+ istream_pos_type line_beg_pos;
+ istream_pos_type curr_pos;
+ optional<datetime_t> prev_epoch;
instance_t(parse_context_t& _context,
std::istream& _in,
@@ -207,11 +206,15 @@ instance_t::instance_t(parse_context_t& _context,
pathname(original_file ? *original_file : "/dev/stdin"), in(_in)
{
TRACE_CTOR(instance_t, "...");
+ DEBUG("times.epoch", "Saving epoch " << epoch);
+ prev_epoch = epoch; // declared in times.h
}
instance_t::~instance_t()
{
TRACE_DTOR(instance_t);
+ epoch = prev_epoch;
+ DEBUG("times.epoch", "Restored epoch to " << epoch);
}
void instance_t::parse()
@@ -420,7 +423,7 @@ void instance_t::clock_in_directive(char * line, bool /*capitalized*/)
position.end_line = linenum;
position.sequence = context.sequence++;
- time_xact_t event(position, parse_datetime(datetime, current_year),
+ time_xact_t event(position, parse_datetime(datetime),
p ? context.top_account()->find_account(p) : NULL,
n ? n : "",
end ? end : "");
@@ -449,7 +452,7 @@ void instance_t::clock_out_directive(char * line, bool /*capitalized*/)
position.end_line = linenum;
position.sequence = context.sequence++;
- time_xact_t event(position, parse_datetime(datetime, current_year),
+ time_xact_t event(position, parse_datetime(datetime),
p ? context.top_account()->find_account(p) : NULL,
n ? n : "",
end ? end : "");
@@ -503,7 +506,12 @@ void instance_t::nomarket_directive(char * line)
void instance_t::year_directive(char * line)
{
- current_year = lexical_cast<unsigned short>(skip_ws(line + 1));
+ unsigned short year(lexical_cast<unsigned short>(skip_ws(line + 1)));
+ DEBUG("times.epoch", "Setting current year to " << year);
+ // This must be set to the last day of the year, otherwise partial
+ // dates like "11/01" will refer to last year's november, not the
+ // current year.
+ epoch = datetime_t(date_t(year, 12, 31));
}
void instance_t::option_directive(char * line)
@@ -554,7 +562,7 @@ void instance_t::automated_xact_directive(char * line)
item = ae.get();
// This is a trailing note, and possibly a metadata info tag
- item->append_note(p + 1, context.scope, true, current_year);
+ item->append_note(p + 1, context.scope, true);
item->pos->end_pos = curr_pos;
item->pos->end_line++;
@@ -634,7 +642,7 @@ void instance_t::period_xact_directive(char * line)
pe->journal = &context.journal;
if (pe->finalize()) {
- context.journal.extend_xact(pe.get(), current_year);
+ context.journal.extend_xact(pe.get());
context.journal.period_xacts.push_back(pe.get());
pe->pos->end_pos = curr_pos;
@@ -885,14 +893,14 @@ void instance_t::assert_directive(char * line)
{
expr_t expr(line);
if (! expr.calc(context.scope).to_boolean())
- throw_(parse_error, _("Assertion failed: %1" << line));
+ throw_(parse_error, _("Assertion failed: %1") << line);
}
void instance_t::check_directive(char * line)
{
expr_t expr(line);
if (! expr.calc(context.scope).to_boolean())
- warning_(_("Check failed: %1" << line));
+ warning_(_("Check failed: %1") << line);
}
void instance_t::expr_directive(char * line)
@@ -1324,7 +1332,7 @@ post_t * instance_t::parse_post(char * line,
// Parse the optional note
if (next && *next == ';') {
- post->append_note(++next, context.scope, true, current_year);
+ post->append_note(++next, context.scope, true);
next = line + len;
DEBUG("textual.parse", "line " << linenum << ": "
<< "Parsed a posting note");
@@ -1343,8 +1351,7 @@ post_t * instance_t::parse_post(char * line,
if (! context.state_stack.empty()) {
foreach (const state_t& state, context.state_stack)
if (state.type() == typeid(string))
- post->parse_tags(boost::get<string>(state).c_str(), context.scope,
- true, current_year);
+ post->parse_tags(boost::get<string>(state).c_str(), context.scope, true);
}
TRACE_STOP(post_details, 1);
@@ -1407,9 +1414,9 @@ xact_t * instance_t::parse_xact(char * line,
if (char * p = std::strchr(line, '=')) {
*p++ = '\0';
- xact->_date_eff = parse_date(p, current_year);
+ xact->_date_eff = parse_date(p);
}
- xact->_date = parse_date(line, current_year);
+ xact->_date = parse_date(line);
// Parse the optional cleared flag: *
@@ -1456,7 +1463,7 @@ xact_t * instance_t::parse_xact(char * line,
// Parse the xact note
if (next && *next == ';')
- xact->append_note(++next, context.scope, false, current_year);
+ xact->append_note(++next, context.scope, false);
TRACE_STOP(xact_text, 1);
@@ -1483,7 +1490,7 @@ xact_t * instance_t::parse_xact(char * line,
if (*p == ';') {
// This is a trailing note, and possibly a metadata info tag
- item->append_note(p + 1, context.scope, true, current_year);
+ item->append_note(p + 1, context.scope, true);
item->pos->end_pos = curr_pos;
item->pos->end_line++;
}
@@ -1502,9 +1509,9 @@ xact_t * instance_t::parse_xact(char * line,
}
else if (! expr.calc(bound_scope).to_boolean()) {
if (c == 'a') {
- throw_(parse_error, _("Transaction assertion failed: %1" << p));
+ throw_(parse_error, _("Transaction assertion failed: %1") << p);
} else {
- warning_(_("Transaction check failed: %1" << p));
+ warning_(_("Transaction check failed: %1") << p);
}
}
}
@@ -1542,7 +1549,7 @@ xact_t * instance_t::parse_xact(char * line,
foreach (const state_t& state, context.state_stack)
if (state.type() == typeid(string))
xact->parse_tags(boost::get<string>(state).c_str(), context.scope,
- false, current_year);
+ false);
}
TRACE_STOP(xact_details, 1);
diff --git a/src/times.cc b/src/times.cc
index a9768f4f..31367e34 100644
--- a/src/times.cc
+++ b/src/times.cc
@@ -194,7 +194,6 @@ namespace {
std::deque<shared_ptr<date_io_t> > readers;
date_t parse_date_mask_routine(const char * date_str, date_io_t& io,
- optional_year year,
date_traits_t * traits = NULL)
{
VERIFY(std::strlen(date_str) < 127);
@@ -229,29 +228,26 @@ namespace {
*traits = io.traits;
if (! io.traits.has_year) {
- when = date_t(year ? *year : CURRENT_DATE().year(),
- when.month(), when.day());
+ when = date_t(CURRENT_DATE().year(), when.month(), when.day());
- if (! year && when.month() > CURRENT_DATE().month())
+ if (when.month() > CURRENT_DATE().month())
when -= gregorian::years(1);
}
}
return when;
}
- date_t parse_date_mask(const char * date_str, optional_year year,
- date_traits_t * traits = NULL)
+ date_t parse_date_mask(const char * date_str, date_traits_t * traits = NULL)
{
if (input_date_io.get()) {
date_t when = parse_date_mask_routine(date_str, *input_date_io.get(),
- year, traits);
+ traits);
if (! when.is_not_a_date())
return when;
}
foreach (shared_ptr<date_io_t>& reader, readers) {
- date_t when = parse_date_mask_routine(date_str, *reader.get(),
- year, traits);
+ date_t when = parse_date_mask_routine(date_str, *reader.get(), traits);
if (! when.is_not_a_date())
return when;
}
@@ -312,7 +308,7 @@ string_to_month_of_year(const std::string& str)
return none;
}
-datetime_t parse_datetime(const char * str, optional_year)
+datetime_t parse_datetime(const char * str)
{
datetime_t when = input_datetime_io->parse(str);
if (when.is_not_a_date_time())
@@ -320,18 +316,16 @@ datetime_t parse_datetime(const char * str, optional_year)
return when;
}
-date_t parse_date(const char * str, optional_year current_year)
+date_t parse_date(const char * str)
{
- return parse_date_mask(str, current_year);
+ return parse_date_mask(str);
}
-date_t date_specifier_t::begin(const optional_year& current_year) const
+date_t date_specifier_t::begin() const
{
- assert(year || current_year);
-
- year_type the_year = year ? *year : static_cast<year_type>(*current_year);
+ year_type the_year = year ? *year : year_type(CURRENT_DATE().year());
month_type the_month = month ? *month : date_t::month_type(1);
- day_type the_day = day ? *day : date_t::day_type(1);
+ day_type the_day = day ? *day : date_t::day_type(1);
#if !defined(NO_ASSERTS)
if (day)
@@ -348,14 +342,14 @@ date_t date_specifier_t::begin(const optional_year& current_year) const
static_cast<date_t::day_type>(the_day));
}
-date_t date_specifier_t::end(const optional_year& current_year) const
+date_t date_specifier_t::end() const
{
if (day || wday)
- return begin(current_year) + gregorian::days(1);
+ return begin() + gregorian::days(1);
else if (month)
- return begin(current_year) + gregorian::months(1);
+ return begin() + gregorian::months(1);
else if (year)
- return begin(current_year) + gregorian::years(1);
+ return begin() + gregorian::years(1);
else {
assert(false);
return date_t();
@@ -667,6 +661,16 @@ void date_parser_t::determine_when(date_parser_t::lexer_t::token_t& tok,
(boost::get<date_time::weekdays>(*tok.value));
break;
+ case lexer_t::token_t::TOK_TODAY:
+ specifier = date_specifier_t(CURRENT_DATE());
+ break;
+ case lexer_t::token_t::TOK_TOMORROW:
+ specifier = date_specifier_t(CURRENT_DATE() + gregorian::days(1));
+ break;
+ case lexer_t::token_t::TOK_YESTERDAY:
+ specifier = date_specifier_t(CURRENT_DATE() - gregorian::days(1));
+ break;
+
default:
tok.unexpected();
break;
@@ -687,14 +691,6 @@ date_interval_t date_parser_t::parse()
tok.kind != lexer_t::token_t::END_REACHED;
tok = lexer.next_token()) {
switch (tok.kind) {
-#if 0
- case lexer_t::token_t::TOK_INT:
- // jww (2009-11-18): NYI
- assert(! "Need to allow for expressions like \"4 months ago\"");
- tok.unexpected();
- break;
-#endif
-
case lexer_t::token_t::TOK_DATE:
if (! inclusion_specifier)
inclusion_specifier = date_specifier_t();
@@ -782,11 +778,44 @@ date_interval_t date_parser_t::parse()
tok = lexer.next_token();
switch (tok.kind) {
- case lexer_t::token_t::TOK_INT:
- // jww (2009-11-18): Allow things like "last 5 weeks"
- assert(! "Need to allow for expressions like \"last 5 weeks\"");
- tok.unexpected();
+ case lexer_t::token_t::TOK_INT: {
+ unsigned short amount = boost::get<unsigned short>(*tok.value);
+
+ date_t base(today);
+ date_t end(today);
+
+ tok = lexer.next_token();
+ switch (tok.kind) {
+ case lexer_t::token_t::TOK_YEARS:
+ base += gregorian::years(amount * adjust);
+ break;
+ case lexer_t::token_t::TOK_QUARTERS:
+ base += gregorian::months(amount * adjust * 3);
+ break;
+ case lexer_t::token_t::TOK_MONTHS:
+ base += gregorian::months(amount * adjust);
+ break;
+ case lexer_t::token_t::TOK_WEEKS:
+ base += gregorian::weeks(amount * adjust);
+ break;
+ case lexer_t::token_t::TOK_DAYS:
+ base += gregorian::days(amount * adjust);
+ break;
+ default:
+ tok.unexpected();
+ break;
+ }
+
+ if (adjust >= 0) {
+ date_t temp = base;
+ base = end;
+ end = temp;
+ }
+
+ since_specifier = date_specifier_t(base);
+ until_specifier = date_specifier_t(end);
break;
+ }
case lexer_t::token_t::TOK_A_MONTH: {
inclusion_specifier = date_specifier_t();
@@ -822,26 +851,40 @@ date_interval_t date_parser_t::parse()
}
case lexer_t::token_t::TOK_QUARTER: {
- date_t temp =
+ date_t base =
date_duration_t::find_nearest(today, date_duration_t::QUARTERS);
- temp += gregorian::months(3 * adjust);
- inclusion_specifier =
- date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()),
- temp.month());
-#if 0
- period.duration = date_duration_t(date_duration_t::QUARTERS, 1);
-#endif
+ date_t temp;
+ if (adjust < 0) {
+ temp = base + gregorian::months(3 * adjust);
+ }
+ else if (adjust == 0) {
+ temp = base + gregorian::months(3);
+ }
+ else if (adjust > 0) {
+ base += gregorian::months(3 * adjust);
+ temp = base + gregorian::months(3 * adjust);
+ }
+ since_specifier = date_specifier_t(adjust < 0 ? temp : base);
+ until_specifier = date_specifier_t(adjust < 0 ? base : temp);
break;
}
case lexer_t::token_t::TOK_WEEK: {
- date_t temp =
+ date_t base =
date_duration_t::find_nearest(today, date_duration_t::WEEKS);
- temp += gregorian::days(7 * adjust);
- inclusion_specifier = date_specifier_t(today);
-#if 0
- period.duration = date_duration_t(date_duration_t::WEEKS, 1);
-#endif
+ date_t temp;
+ if (adjust < 0) {
+ temp = base + gregorian::days(7 * adjust);
+ }
+ else if (adjust == 0) {
+ temp = base + gregorian::days(7);
+ }
+ else if (adjust > 0) {
+ base += gregorian::days(7 * adjust);
+ temp = base + gregorian::days(7 * adjust);
+ }
+ since_specifier = date_specifier_t(adjust < 0 ? temp : base);
+ until_specifier = date_specifier_t(adjust < 0 ? base : temp);
break;
}
@@ -862,6 +905,7 @@ date_interval_t date_parser_t::parse()
break;
}
}
+ break;
}
case lexer_t::token_t::TOK_TODAY:
@@ -876,7 +920,7 @@ date_interval_t date_parser_t::parse()
case lexer_t::token_t::TOK_EVERY:
tok = lexer.next_token();
- if (tok == lexer_t::token_t::TOK_INT) {
+ if (tok.kind == lexer_t::token_t::TOK_INT) {
int quantity = boost::get<unsigned short>(*tok.value);
tok = lexer.next_token();
switch (tok.kind) {
@@ -1052,8 +1096,8 @@ void date_interval_t::stabilize(const optional<date_t>& date)
// want a date early enough that the range will be correct, but late
// enough that we don't spend hundreds of thousands of loops skipping
// through time.
- optional<date_t> initial_start = start ? start : begin(date->year());
- optional<date_t> initial_finish = finish ? finish : end(date->year());
+ optional<date_t> initial_start = start ? start : begin();
+ optional<date_t> initial_finish = finish ? finish : end();
#if defined(DEBUG_ON)
if (initial_start)
@@ -1116,13 +1160,8 @@ void date_interval_t::stabilize(const optional<date_t>& date)
#endif
}
else if (range) {
- if (date) {
- start = range->begin(date->year());
- finish = range->end(date->year());
- } else {
- start = range->begin();
- finish = range->end();
- }
+ start = range->begin();
+ finish = range->end();
}
aligned = true;
}
@@ -1228,7 +1267,7 @@ date_interval_t& date_interval_t::operator++()
return *this;
}
-void date_interval_t::dump(std::ostream& out, optional_year current_year)
+void date_interval_t::dump(std::ostream& out)
{
out << _("--- Before stabilization ---") << std::endl;
@@ -1242,7 +1281,7 @@ void date_interval_t::dump(std::ostream& out, optional_year current_year)
if (duration)
out << _("duration: ") << duration->to_string() << std::endl;
- stabilize(begin(current_year));
+ stabilize(begin());
out << std::endl
<< _("--- After stabilization ---") << std::endl;
@@ -1317,7 +1356,7 @@ date_parser_t::lexer_t::token_t date_parser_t::lexer_t::next_token()
try {
date_traits_t traits;
- date_t when = parse_date_mask(possible_date.c_str(), none, &traits);
+ date_t when = parse_date_mask(possible_date.c_str(), &traits);
if (! when.is_not_a_date()) {
begin = i;
return token_t(token_t::TOK_DATE,
diff --git a/src/times.h b/src/times.h
index 02b39ef7..ac96669d 100644
--- a/src/times.h
+++ b/src/times.h
@@ -77,27 +77,23 @@ extern optional<datetime_t> epoch;
#define CURRENT_DATE() \
(epoch ? epoch->date() : boost::gregorian::day_clock::universal_day())
-extern date_time::weekdays start_of_week;
+extern date_time::weekdays start_of_week;
optional<date_time::weekdays>
string_to_day_of_week(const std::string& str);
optional<date_time::months_of_year>
string_to_month_of_year(const std::string& str);
-typedef optional<date_t::year_type> optional_year;
+datetime_t parse_datetime(const char * str);
-datetime_t parse_datetime(const char * str, optional_year current_year = none);
-
-inline datetime_t parse_datetime(const std::string& str,
- optional_year current_year = none) {
- return parse_datetime(str.c_str(), current_year);
+inline datetime_t parse_datetime(const std::string& str) {
+ return parse_datetime(str.c_str());
}
-date_t parse_date(const char * str, optional_year current_year = none);
+date_t parse_date(const char * str);
-inline date_t parse_date(const std::string& str,
- optional_year current_year = none) {
- return parse_date(str.c_str(), current_year);
+inline date_t parse_date(const std::string& str) {
+ return parse_date(str.c_str());
}
enum format_type_t {
@@ -329,12 +325,11 @@ public:
TRACE_DTOR(date_specifier_t);
}
- date_t begin(const optional_year& current_year = none) const;
- date_t end(const optional_year& current_year = none) const;
+ date_t begin() const;
+ date_t end() const;
- bool is_within(const date_t& date,
- const optional_year& current_year = none) const {
- return date >= begin(current_year) && date < end(current_year);
+ bool is_within(const date_t& date) const {
+ return date >= begin() && date < end();
}
optional<date_duration_t> implied_duration() const {
@@ -404,27 +399,26 @@ public:
TRACE_DTOR(date_range_t);
}
- optional<date_t> begin(const optional_year& current_year = none) const {
+ optional<date_t> begin() const {
if (range_begin)
- return range_begin->begin(current_year);
+ return range_begin->begin();
else
return none;
}
- optional<date_t> end(const optional_year& current_year = none) const {
+ optional<date_t> end() const {
if (range_end) {
if (end_inclusive)
- return range_end->end(current_year);
+ return range_end->end();
else
- return range_end->begin(current_year);
+ return range_end->begin();
} else {
return none;
}
}
- bool is_within(const date_t& date,
- const optional_year& current_year = none) const {
- optional<date_t> b = begin(current_year);
- optional<date_t> e = end(current_year);
+ bool is_within(const date_t& date) const {
+ optional<date_t> b = begin();
+ optional<date_t> e = end();
bool after_begin = b ? date >= *b : true;
bool before_end = e ? date < *e : true;
return after_begin && before_end;
@@ -482,19 +476,19 @@ public:
TRACE_DTOR(date_specifier_or_range_t);
}
- optional<date_t> begin(const optional_year& current_year = none) const {
+ optional<date_t> begin() const {
if (specifier_or_range.type() == typeid(date_specifier_t))
- return boost::get<date_specifier_t>(specifier_or_range).begin(current_year);
+ return boost::get<date_specifier_t>(specifier_or_range).begin();
else if (specifier_or_range.type() == typeid(date_range_t))
- return boost::get<date_range_t>(specifier_or_range).begin(current_year);
+ return boost::get<date_range_t>(specifier_or_range).begin();
else
return none;
}
- optional<date_t> end(const optional_year& current_year = none) const {
+ optional<date_t> end() const {
if (specifier_or_range.type() == typeid(date_specifier_t))
- return boost::get<date_specifier_t>(specifier_or_range).end(current_year);
+ return boost::get<date_specifier_t>(specifier_or_range).end();
else if (specifier_or_range.type() == typeid(date_range_t))
- return boost::get<date_range_t>(specifier_or_range).end(current_year);
+ return boost::get<date_range_t>(specifier_or_range).end();
else
return none;
}
@@ -571,11 +565,11 @@ public:
return is_valid();
}
- optional<date_t> begin(const optional_year& current_year = none) const {
- return start ? start : (range ? range->begin(current_year) : none);
+ optional<date_t> begin() const {
+ return start ? start : (range ? range->begin() : none);
}
- optional<date_t> end(const optional_year& current_year = none) const {
- return finish ? finish : (range ? range->end(current_year) : none);
+ optional<date_t> end() const {
+ return finish ? finish : (range ? range->end() : none);
}
void parse(const string& str);
@@ -590,7 +584,7 @@ public:
/** Find the current or next period containing date. Returns true if the
date_interval_t object has been altered to reflect the interval
containing date, or false if no such period can be found. */
- bool find_period(const date_t& date);
+ bool find_period(const date_t& date = CURRENT_DATE());
optional<date_t> inclusive_end() const {
if (end_of_duration)
@@ -601,7 +595,7 @@ public:
date_interval_t& operator++();
- void dump(std::ostream& out, optional_year current_year = none);
+ void dump(std::ostream& out);
#if defined(HAVE_BOOST_SERIALIZATION)
private:
diff --git a/src/xact.cc b/src/xact.cc
index 1188fd0f..d8ed3f8b 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -509,7 +509,7 @@ namespace {
foreach (post_t * p, post.xact->posts) {
bind_scope_t bound_scope(args, *p);
- if (expr->calc(bound_scope).to_boolean())
+ if (expr->calc(bound_scope, args.locus, args.depth).to_boolean())
return true;
}
return false;
@@ -522,7 +522,7 @@ namespace {
foreach (post_t * p, post.xact->posts) {
bind_scope_t bound_scope(args, *p);
- if (! expr->calc(bound_scope).to_boolean())
+ if (! expr->calc(bound_scope, args.locus, args.depth).to_boolean())
return false;
}
return true;
@@ -629,8 +629,7 @@ namespace {
} // unnamed namespace
-void auto_xact_t::extend_xact(xact_base_t& xact,
- optional<date_t::year_type> current_year)
+void auto_xact_t::extend_xact(xact_base_t& xact)
{
posts_list initial_posts(xact.posts.begin(), xact.posts.end());
@@ -680,10 +679,8 @@ void auto_xact_t::extend_xact(xact_base_t& xact,
if (deferred_notes) {
foreach (deferred_tag_data_t& data, *deferred_notes) {
if (data.apply_to_post == NULL)
- initial_post->parse_tags(data.tag_data.c_str(),
- bound_scope,
- data.overwrite_existing,
- current_year);
+ initial_post->parse_tags(data.tag_data.c_str(), bound_scope,
+ data.overwrite_existing);
}
}
if (check_exprs) {
@@ -694,9 +691,9 @@ void auto_xact_t::extend_xact(xact_base_t& xact,
else if (! pair.first.calc(bound_scope).to_boolean()) {
if (pair.second == auto_xact_t::EXPR_ASSERTION) {
throw_(parse_error,
- _("Transaction assertion failed: %1" << pair.first));
+ _("Transaction assertion failed: %1") << pair.first);
} else {
- warning_(_("Transaction check failed: %1" << pair.first));
+ warning_(_("Transaction check failed: %1") << pair.first);
}
}
}
@@ -778,10 +775,8 @@ void auto_xact_t::extend_xact(xact_base_t& xact,
if (deferred_notes) {
foreach (deferred_tag_data_t& data, *deferred_notes) {
if (data.apply_to_post == post)
- new_post->parse_tags(data.tag_data.c_str(),
- bound_scope,
- data.overwrite_existing,
- current_year);
+ new_post->parse_tags(data.tag_data.c_str(), bound_scope,
+ data.overwrite_existing);
}
}
}
diff --git a/src/xact.h b/src/xact.h
index a3c639b9..41e58545 100644
--- a/src/xact.h
+++ b/src/xact.h
@@ -196,15 +196,13 @@ public:
virtual void parse_tags(const char * p,
scope_t&,
- bool overwrite_existing = true,
- optional<date_t::year_type> = none) {
+ bool overwrite_existing = true) {
if (! deferred_notes)
deferred_notes = deferred_notes_list();
deferred_notes->push_back(deferred_tag_data_t(p, overwrite_existing));
}
- virtual void extend_xact(xact_base_t& xact,
- optional<date_t::year_type> current_year);
+ virtual void extend_xact(xact_base_t& xact);
#if defined(HAVE_BOOST_SERIALIZATION)
private:
diff --git a/test/RegressTests.py b/test/RegressTests.py
index 13a0a113..a32bdb6b 100755
--- a/test/RegressTests.py
+++ b/test/RegressTests.py
@@ -23,6 +23,7 @@ class RegressFile:
def is_directive(self, line):
return line == "<<<\n" or \
+ line == ">>>\n" or \
line == ">>>1\n" or \
line == ">>>2\n" or \
line.startswith("===")
@@ -42,10 +43,10 @@ class RegressFile:
def read_test(self, last_test = None):
test = {
'command': None,
- 'input': None,
- 'output': None,
- 'error': None,
- 'exitcode': None
+ 'input': "",
+ 'output': "",
+ 'error': "",
+ 'exitcode': 0
}
if last_test:
test['input'] = last_test['input']
@@ -54,7 +55,7 @@ class RegressFile:
while line:
if line == "<<<\n":
(test['input'], line) = self.read_section()
- elif line == ">>>1\n":
+ elif line == ">>>\n" or line == ">>>1\n":
(test['output'], line) = self.read_section()
elif line == ">>>2\n":
(test['error'], line) = self.read_section()
diff --git a/test/baseline/opt-abbrev-len.test b/test/baseline/opt-abbrev-len.test
index 40313b22..59164163 100644
--- a/test/baseline/opt-abbrev-len.test
+++ b/test/baseline/opt-abbrev-len.test
@@ -4,8 +4,8 @@ reg --abbrev-len=4
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX Asse:Inve:Vang:VMMXX 0.350 VMMXX 0.350 VMMXX
- Inco:Divi:Vang:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX Asse:Inve:Vangua:VMMXX 0.350 VMMXX 0.350 VMMXX
+ Inco:Divi:Vangua:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-account.test b/test/baseline/opt-account.test
index 10176fde..e577d72b 100644
--- a/test/baseline/opt-account.test
+++ b/test/baseline/opt-account.test
@@ -4,8 +4,8 @@ reg --account='payee + ":" + commodity'
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX RD:VM:As:In:Va:VMMXX 0.350 VMMXX 0.350 VMMXX
-07-Feb-02 RD VMMXX RD:$:In:Di:Va:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX RD:VM:As:In:Vang:VMMXX 0.350 VMMXX 0.350 VMMXX
+07-Feb-02 RD VMMXX RD:$:In:Di:Vangu:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-amount-width.test b/test/baseline/opt-amount-width.test
index 32282214..c79229dc 100644
--- a/test/baseline/opt-amount-width.test
+++ b/test/baseline/opt-amount-width.test
@@ -4,8 +4,8 @@ reg --amount-width=18
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Investm:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Dividen:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-amount.test b/test/baseline/opt-amount.test
index 2ebbf055..36107fa8 100644
--- a/test/baseline/opt-amount.test
+++ b/test/baseline/opt-amount.test
@@ -4,7 +4,7 @@ reg --amount=10
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 10 10
- In:Di:Vanguard:VMMXX 10 20
+07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 10 10
+ In:Divid:Vanguar:VMMXX 10 20
>>>2
=== 0
diff --git a/test/baseline/opt-collapse-if-zero.test b/test/baseline/opt-collapse-if-zero.test
index fb4d33fd..ec3aa6d3 100644
--- a/test/baseline/opt-collapse-if-zero.test
+++ b/test/baseline/opt-collapse-if-zero.test
@@ -8,8 +8,8 @@ reg --collapse-if-zero
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Divid:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-columns.test b/test/baseline/opt-columns.test
index 4dc28d9b..ae8145b9 100644
--- a/test/baseline/opt-columns.test
+++ b/test/baseline/opt-columns.test
@@ -4,8 +4,8 @@ reg --columns=100
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:Investments:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Dividends:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX Asse:Investment:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
+ Incom:Dividends:Vanguard:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-commodity-as-account.test b/test/baseline/opt-commodity-as-account.test
index 2e723347..8fa813fd 100644
--- a/test/baseline/opt-commodity-as-account.test
+++ b/test/baseline/opt-commodity-as-account.test
@@ -4,8 +4,8 @@ reg --account=commodity
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX VM:As:In:Va:VMMXX 0.350 VMMXX 0.350 VMMXX
-07-Feb-02 RD VMMXX $:In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX VM:As:Inve:Vangu:VMMXX 0.350 VMMXX 0.350 VMMXX
+07-Feb-02 RD VMMXX $:In:Divi:Vangua:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-commodity-as-payee.test b/test/baseline/opt-commodity-as-payee.test
index 2f829b4a..dbc91b72 100644
--- a/test/baseline/opt-commodity-as-payee.test
+++ b/test/baseline/opt-commodity-as-payee.test
@@ -4,8 +4,8 @@ reg --payee=commodity
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
-07-Feb-02 $ In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+07-Feb-02 $ In:Divid:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-date-format.test b/test/baseline/opt-date-format.test
index b4e1a332..0d3ee6fa 100644
--- a/test/baseline/opt-date-format.test
+++ b/test/baseline/opt-date-format.test
@@ -4,8 +4,8 @@ reg --date-format='%Y'
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-2007 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+2007 RD VMMXX As:Investm:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Dividen:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-date-width.test b/test/baseline/opt-date-width.test
index 47652099..c7aa7731 100644
--- a/test/baseline/opt-date-width.test
+++ b/test/baseline/opt-date-width.test
@@ -4,8 +4,8 @@ reg --date-width=20
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Investm:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Dividen:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-empty.test b/test/baseline/opt-empty.test
index 507767ed..7bf830a9 100644
--- a/test/baseline/opt-empty.test
+++ b/test/baseline/opt-empty.test
@@ -24,13 +24,13 @@ reg --empty
Assets:Cash $-10.00 0
08-Jan-01 January Expenses:One:Books $10.00 $10.00
Expenses:One:Two:Books $10.00 $20.00
- Ex:One:Two:Three:Books $10.00 $30.00
+ Expe:On:Tw:Three:Books $10.00 $30.00
Assets:Cash $-30.00 0
08-Jan-01 January Assets:Cash 0 0
Income:Books 0 0
08-Jan-01 January Assets:Cash $30.00 $30.00
Income:One:Books $-10.00 $20.00
Income:One:Two:Books $-10.00 $10.00
- In:One:Two:Three:Books $-10.00 0
+ Inc:On:Two:Three:Books $-10.00 0
>>>2
=== 0
diff --git a/test/baseline/opt-forecast-while.test b/test/baseline/opt-forecast-while.test
index c2563a75..e3f1c57a 100644
--- a/test/baseline/opt-forecast-while.test
+++ b/test/baseline/opt-forecast-while.test
@@ -244,42 +244,42 @@ reg --now=2009/03/21 --forecast-while='total < $3500' books
09-Nov-30 End of November Expenses:Books $110.00 $2880.00
09-Dec-01 December Expenses:Books $120.00 $3000.00
09-Dec-31 End of December Expenses:Books $120.00 $3120.00
-09-May-01 Forecast transaction Expenses:Books $10.00 $3130.00
-09-Jun-01 Forecast transaction Expenses:Books $10.00 $3140.00
-09-Jul-01 Forecast transaction Expenses:Books $10.00 $3150.00
-09-Aug-01 Forecast transaction Expenses:Books $10.00 $3160.00
-09-Sep-01 Forecast transaction Expenses:Books $10.00 $3170.00
-09-Oct-01 Forecast transaction Expenses:Books $10.00 $3180.00
-09-Nov-01 Forecast transaction Expenses:Books $10.00 $3190.00
-09-Dec-01 Forecast transaction Expenses:Books $10.00 $3200.00
-10-Jan-01 Forecast transaction Expenses:Books $10.00 $3210.00
-10-Feb-01 Forecast transaction Expenses:Books $10.00 $3220.00
-10-Mar-01 Forecast transaction Expenses:Books $10.00 $3230.00
-10-Apr-01 Forecast transaction Expenses:Books $10.00 $3240.00
-10-May-01 Forecast transaction Expenses:Books $10.00 $3250.00
-10-Jun-01 Forecast transaction Expenses:Books $10.00 $3260.00
-10-Jul-01 Forecast transaction Expenses:Books $10.00 $3270.00
-10-Aug-01 Forecast transaction Expenses:Books $10.00 $3280.00
-10-Sep-01 Forecast transaction Expenses:Books $10.00 $3290.00
-10-Oct-01 Forecast transaction Expenses:Books $10.00 $3300.00
-10-Nov-01 Forecast transaction Expenses:Books $10.00 $3310.00
-10-Dec-01 Forecast transaction Expenses:Books $10.00 $3320.00
-11-Jan-01 Forecast transaction Expenses:Books $10.00 $3330.00
-11-Feb-01 Forecast transaction Expenses:Books $10.00 $3340.00
-11-Mar-01 Forecast transaction Expenses:Books $10.00 $3350.00
-11-Apr-01 Forecast transaction Expenses:Books $10.00 $3360.00
-11-May-01 Forecast transaction Expenses:Books $10.00 $3370.00
-11-Jun-01 Forecast transaction Expenses:Books $10.00 $3380.00
-11-Jul-01 Forecast transaction Expenses:Books $10.00 $3390.00
-11-Aug-01 Forecast transaction Expenses:Books $10.00 $3400.00
-11-Sep-01 Forecast transaction Expenses:Books $10.00 $3410.00
-11-Oct-01 Forecast transaction Expenses:Books $10.00 $3420.00
-11-Nov-01 Forecast transaction Expenses:Books $10.00 $3430.00
-11-Dec-01 Forecast transaction Expenses:Books $10.00 $3440.00
-12-Jan-01 Forecast transaction Expenses:Books $10.00 $3450.00
-12-Feb-01 Forecast transaction Expenses:Books $10.00 $3460.00
-12-Mar-01 Forecast transaction Expenses:Books $10.00 $3470.00
-12-Apr-01 Forecast transaction Expenses:Books $10.00 $3480.00
-12-May-01 Forecast transaction Expenses:Books $10.00 $3490.00
+09-Apr-01 Forecast transaction Expenses:Books $10.00 $3130.00
+09-May-01 Forecast transaction Expenses:Books $10.00 $3140.00
+09-Jun-01 Forecast transaction Expenses:Books $10.00 $3150.00
+09-Jul-01 Forecast transaction Expenses:Books $10.00 $3160.00
+09-Aug-01 Forecast transaction Expenses:Books $10.00 $3170.00
+09-Sep-01 Forecast transaction Expenses:Books $10.00 $3180.00
+09-Oct-01 Forecast transaction Expenses:Books $10.00 $3190.00
+09-Nov-01 Forecast transaction Expenses:Books $10.00 $3200.00
+09-Dec-01 Forecast transaction Expenses:Books $10.00 $3210.00
+10-Jan-01 Forecast transaction Expenses:Books $10.00 $3220.00
+10-Feb-01 Forecast transaction Expenses:Books $10.00 $3230.00
+10-Mar-01 Forecast transaction Expenses:Books $10.00 $3240.00
+10-Apr-01 Forecast transaction Expenses:Books $10.00 $3250.00
+10-May-01 Forecast transaction Expenses:Books $10.00 $3260.00
+10-Jun-01 Forecast transaction Expenses:Books $10.00 $3270.00
+10-Jul-01 Forecast transaction Expenses:Books $10.00 $3280.00
+10-Aug-01 Forecast transaction Expenses:Books $10.00 $3290.00
+10-Sep-01 Forecast transaction Expenses:Books $10.00 $3300.00
+10-Oct-01 Forecast transaction Expenses:Books $10.00 $3310.00
+10-Nov-01 Forecast transaction Expenses:Books $10.00 $3320.00
+10-Dec-01 Forecast transaction Expenses:Books $10.00 $3330.00
+11-Jan-01 Forecast transaction Expenses:Books $10.00 $3340.00
+11-Feb-01 Forecast transaction Expenses:Books $10.00 $3350.00
+11-Mar-01 Forecast transaction Expenses:Books $10.00 $3360.00
+11-Apr-01 Forecast transaction Expenses:Books $10.00 $3370.00
+11-May-01 Forecast transaction Expenses:Books $10.00 $3380.00
+11-Jun-01 Forecast transaction Expenses:Books $10.00 $3390.00
+11-Jul-01 Forecast transaction Expenses:Books $10.00 $3400.00
+11-Aug-01 Forecast transaction Expenses:Books $10.00 $3410.00
+11-Sep-01 Forecast transaction Expenses:Books $10.00 $3420.00
+11-Oct-01 Forecast transaction Expenses:Books $10.00 $3430.00
+11-Nov-01 Forecast transaction Expenses:Books $10.00 $3440.00
+11-Dec-01 Forecast transaction Expenses:Books $10.00 $3450.00
+12-Jan-01 Forecast transaction Expenses:Books $10.00 $3460.00
+12-Feb-01 Forecast transaction Expenses:Books $10.00 $3470.00
+12-Mar-01 Forecast transaction Expenses:Books $10.00 $3480.00
+12-Apr-01 Forecast transaction Expenses:Books $10.00 $3490.00
>>>2
=== 0
diff --git a/test/baseline/opt-gain.test b/test/baseline/opt-gain.test
index 6d139c79..d2e9abfe 100644
--- a/test/baseline/opt-gain.test
+++ b/test/baseline/opt-gain.test
@@ -51,16 +51,16 @@ P 2010/04/01 00:00:00 S 16 P
>>>1
09-Jan-15 Commodities revalued <Revalued> 100 P 100 P
09-Feb-01 Commodities revalued <Revalued> 200 P 300 P
-09-Feb-01 Sample 2a As:Brokerage:Stocks 300 P 600 P
+09-Feb-01 Sample 2a Asset:Brokerage:Stocks 300 P 600 P
09-Mar-01 Commodities revalued <Revalued> 800 P 1400 P
-09-Mar-01 Sample 3a As:Brokerage:Stocks 700 P 2100 P
+09-Mar-01 Sample 3a Asset:Brokerage:Stocks 700 P 2100 P
09-Apr-01 Commodities revalued <Revalued> 2400 P 4500 P
-09-Apr-01 Sample 4a As:Brokerage:Stocks -1500 P 3000 P
+09-Apr-01 Sample 4a Asset:Brokerage:Stocks -1500 P 3000 P
10-Feb-01 Commodities revalued <Revalued> -2400 P 600 P
-10-Feb-01 Sample 2b As:Brokerage:Stocks 300 P 900 P
+10-Feb-01 Sample 2b Asset:Brokerage:Stocks 300 P 900 P
10-Mar-01 Commodities revalued <Revalued> 1200 P 2100 P
-10-Mar-01 Sample 3b As:Brokerage:Stocks 700 P 2800 P
+10-Mar-01 Sample 3b Asset:Brokerage:Stocks 700 P 2800 P
10-Apr-01 Commodities revalued <Revalued> 3200 P 6000 P
-10-Apr-01 Sample 4b As:Brokerage:Stocks -1500 P 4500 P
+10-Apr-01 Sample 4b Asset:Brokerage:Stocks -1500 P 4500 P
>>>2
=== 0
diff --git a/test/baseline/opt-input-date-format.test b/test/baseline/opt-input-date-format.test
index 0ab5e5c9..4e77bc28 100644
--- a/test/baseline/opt-input-date-format.test
+++ b/test/baseline/opt-input-date-format.test
@@ -4,8 +4,8 @@ reg --input-date-format='%m%%%d%%%Y'
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Divid:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-invert.test b/test/baseline/opt-invert.test
index 9a9f6d02..c010c264 100644
--- a/test/baseline/opt-invert.test
+++ b/test/baseline/opt-invert.test
@@ -4,8 +4,8 @@ reg --invert
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX -0.350 VMMXX -0.350 VMMXX
- In:Di:Vanguard:VMMXX $0.35 $0.35
+07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX -0.350 VMMXX -0.350 VMMXX
+ In:Divid:Vanguar:VMMXX $0.35 $0.35
-0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-market.test b/test/baseline/opt-market.test
index b6c0ed6d..8c5b168a 100644
--- a/test/baseline/opt-market.test
+++ b/test/baseline/opt-market.test
@@ -49,18 +49,18 @@ P 2010/03/01 00:00:00 S 8 P
P 2010/04/01 00:00:00 S 16 P
>>>1
-09-Jan-01 Sample 1a As:Brokerage:Stocks 200 P 200 P
+09-Jan-01 Sample 1a Asset:Brokerage:Stocks 200 P 200 P
09-Feb-01 Commodities revalued <Revalued> 200 P 400 P
-09-Feb-01 Sample 2a As:Brokerage:Stocks 400 P 800 P
+09-Feb-01 Sample 2a Asset:Brokerage:Stocks 400 P 800 P
09-Mar-01 Commodities revalued <Revalued> 800 P 1600 P
-09-Mar-01 Sample 3a As:Brokerage:Stocks 800 P 2400 P
+09-Mar-01 Sample 3a Asset:Brokerage:Stocks 800 P 2400 P
09-Apr-01 Commodities revalued <Revalued> 2400 P 4800 P
-09-Apr-01 Sample 4a As:Brokerage:Stocks -1600 P 3200 P
+09-Apr-01 Sample 4a Asset:Brokerage:Stocks -1600 P 3200 P
10-Feb-01 Commodities revalued <Revalued> -2400 P 800 P
-10-Feb-01 Sample 2b As:Brokerage:Stocks 400 P 1200 P
+10-Feb-01 Sample 2b Asset:Brokerage:Stocks 400 P 1200 P
10-Mar-01 Commodities revalued <Revalued> 1200 P 2400 P
-10-Mar-01 Sample 3b As:Brokerage:Stocks 800 P 3200 P
+10-Mar-01 Sample 3b Asset:Brokerage:Stocks 800 P 3200 P
10-Apr-01 Commodities revalued <Revalued> 3200 P 6400 P
-10-Apr-01 Sample 4b As:Brokerage:Stocks -1600 P 4800 P
+10-Apr-01 Sample 4b Asset:Brokerage:Stocks -1600 P 4800 P
>>>2
=== 0
diff --git a/test/baseline/opt-output.test b/test/baseline/opt-output.test
index 49881fb3..2339a3a1 100644
--- a/test/baseline/opt-output.test
+++ b/test/baseline/opt-output.test
@@ -5,7 +5,7 @@ reg --output=/dev/stderr
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
>>>2
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Divid:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
=== 0
diff --git a/test/baseline/opt-pager.test b/test/baseline/opt-pager.test
index 2a109ad7..060c4bb8 100644
--- a/test/baseline/opt-pager.test
+++ b/test/baseline/opt-pager.test
@@ -4,8 +4,8 @@ reg --pager=cat
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Divid:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-payee-as-account.test b/test/baseline/opt-payee-as-account.test
index 6aca0dab..561a6c3b 100644
--- a/test/baseline/opt-payee-as-account.test
+++ b/test/baseline/opt-payee-as-account.test
@@ -22,12 +22,12 @@ reg --account=payee
>>>1
08-Jan-01 January January:Expenses:Books $10.00 $10.00
08-Jan-01 January January:Assets:Cash $-10.00 0
-08-Jan-31 End of January En:Expenses:Books $10.00 $10.00
-08-Jan-31 End of January En:Assets:Cash $-10.00 0
-08-Feb-01 February Fe:Expenses:Books $20.00 $20.00
+08-Jan-31 End of January End of J:Expense:Books $10.00 $10.00
+08-Jan-31 End of January End of Jan:Assets:Cash $-10.00 0
+08-Feb-01 February Februar:Expenses:Books $20.00 $20.00
08-Feb-01 February February:Assets:Cash $-20.00 0
-08-Feb-28 End of February En:Expenses:Books $20.00 $20.00
-08-Feb-28 End of February En:Assets:Cash $-20.00 0
+08-Feb-28 End of February End of F:Expense:Books $20.00 $20.00
+08-Feb-28 End of February End of Feb:Assets:Cash $-20.00 0
08-Mar-01 March March:Expenses:Books $30.00 $30.00
08-Mar-01 March March:Assets:Cash $-30.00 0
>>>2
diff --git a/test/baseline/opt-payee-width.test b/test/baseline/opt-payee-width.test
index a5f61e87..d92dbe00 100644
--- a/test/baseline/opt-payee-width.test
+++ b/test/baseline/opt-payee-width.test
@@ -4,8 +4,8 @@ reg --payee-width=40
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Investm:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Dividen:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-payee.test b/test/baseline/opt-payee.test
index 56ee0cde..a028bb91 100644
--- a/test/baseline/opt-payee.test
+++ b/test/baseline/opt-payee.test
@@ -4,8 +4,8 @@ reg --payee='account_base + ":" + commodity'
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 VMMXX:VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
-07-Feb-02 VMMXX:$ In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 VMMXX:VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+07-Feb-02 VMMXX:$ In:Divid:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-quantity.test b/test/baseline/opt-quantity.test
index 5de92e84..f8cd0e4c 100644
--- a/test/baseline/opt-quantity.test
+++ b/test/baseline/opt-quantity.test
@@ -4,8 +4,8 @@ reg --quantity
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Divid:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-revalued.test b/test/baseline/opt-revalued.test
index b68b256b..541a4e02 100644
--- a/test/baseline/opt-revalued.test
+++ b/test/baseline/opt-revalued.test
@@ -49,18 +49,18 @@ P 2010/03/01 00:00:00 S 8 P
P 2010/04/01 00:00:00 S 16 P
>>>1
-09-Jan-01 Sample 1a As:Brokerage:Stocks 200 P 200 P
+09-Jan-01 Sample 1a Asset:Brokerage:Stocks 200 P 200 P
09-Feb-01 Commodities revalued <Revalued> 200 P 400 P
-09-Feb-01 Sample 2a As:Brokerage:Stocks 400 P 800 P
+09-Feb-01 Sample 2a Asset:Brokerage:Stocks 400 P 800 P
09-Mar-01 Commodities revalued <Revalued> 800 P 1600 P
-09-Mar-01 Sample 3a As:Brokerage:Stocks 800 P 2400 P
+09-Mar-01 Sample 3a Asset:Brokerage:Stocks 800 P 2400 P
09-Apr-01 Commodities revalued <Revalued> 2400 P 4800 P
-09-Apr-01 Sample 4a As:Brokerage:Stocks -1600 P 3200 P
+09-Apr-01 Sample 4a Asset:Brokerage:Stocks -1600 P 3200 P
10-Feb-01 Commodities revalued <Revalued> -2400 P 800 P
-10-Feb-01 Sample 2b As:Brokerage:Stocks 400 P 1200 P
+10-Feb-01 Sample 2b Asset:Brokerage:Stocks 400 P 1200 P
10-Mar-01 Commodities revalued <Revalued> 1200 P 2400 P
-10-Mar-01 Sample 3b As:Brokerage:Stocks 800 P 3200 P
+10-Mar-01 Sample 3b Asset:Brokerage:Stocks 800 P 3200 P
10-Apr-01 Commodities revalued <Revalued> 3200 P 6400 P
-10-Apr-01 Sample 4b As:Brokerage:Stocks -1600 P 4800 P
+10-Apr-01 Sample 4b Asset:Brokerage:Stocks -1600 P 4800 P
>>>2
=== 0
diff --git a/test/baseline/opt-sort-all.test b/test/baseline/opt-sort-all.test
index b289f8e8..974f95c4 100644
--- a/test/baseline/opt-sort-all.test
+++ b/test/baseline/opt-sort-all.test
@@ -84,33 +84,33 @@ reg --monthly --sort=-amount
Expenses:Travel:Passport $127.00
Assets:Checking
>>>1
-08-Jan-01 - 08-Jan-31 Ex:Travel:Airfare $222.19 $222.19
+08-Jan-01 - 08-Jan-31 Expense:Travel:Airfare $222.19 $222.19
Liabilities:MasterCard $-222.19 0
-08-Feb-01 - 08-Feb-29 Ex:Travel:Airfare $477.60 $477.60
+08-Feb-01 - 08-Feb-29 Expense:Travel:Airfare $477.60 $477.60
Expenses:Travel:Auto $280.97 $758.57
Liabilities:MasterCard $-758.57 0
-08-Mar-01 - 08-Mar-31 Ex:Travel:Airfare $2,463.20 $2,463.20
+08-Mar-01 - 08-Mar-31 Expense:Travel:Airfare $2,463.20 $2,463.20
Liabilities:MasterCard $-2,463.20 0
-08-Apr-01 - 08-Apr-30 Ex:Travel:Airfare $1,186.14 $1,186.14
+08-Apr-01 - 08-Apr-30 Expense:Travel:Airfare $1,186.14 $1,186.14
Liabilities:MasterCard $-1,186.14 0
-08-Aug-01 - 08-Aug-31 Ex:Travel:Passport $170.00 $170.00
+08-Aug-01 - 08-Aug-31 Expens:Travel:Passport $170.00 $170.00
Liabilities:MasterCard $-170.00 0
-08-Sep-01 - 08-Sep-30 Ex:Travel:Airfare $3,925.94 $3,925.94
+08-Sep-01 - 08-Sep-30 Expense:Travel:Airfare $3,925.94 $3,925.94
Liabilities:MasterCard $-3,925.94 0
-08-Dec-01 - 08-Dec-31 Ex:Travel:Passport $254.00 $254.00
+08-Dec-01 - 08-Dec-31 Expens:Travel:Passport $254.00 $254.00
Assets:Checking $-254.00 0
>>>2
=== 0
reg --monthly --sort-all=-amount
>>>1
-08-Sep-01 - 08-Sep-30 Ex:Travel:Airfare $3,925.94 $3,925.94
-08-Mar-01 - 08-Mar-31 Ex:Travel:Airfare $2,463.20 $6,389.14
-08-Apr-01 - 08-Apr-30 Ex:Travel:Airfare $1,186.14 $7,575.28
-08-Feb-01 - 08-Feb-29 Ex:Travel:Airfare $477.60 $8,052.88
+08-Sep-01 - 08-Sep-30 Expense:Travel:Airfare $3,925.94 $3,925.94
+08-Mar-01 - 08-Mar-31 Expense:Travel:Airfare $2,463.20 $6,389.14
+08-Apr-01 - 08-Apr-30 Expense:Travel:Airfare $1,186.14 $7,575.28
+08-Feb-01 - 08-Feb-29 Expense:Travel:Airfare $477.60 $8,052.88
Expenses:Travel:Auto $280.97 $8,333.85
-08-Dec-01 - 08-Dec-31 Ex:Travel:Passport $254.00 $8,587.85
-08-Jan-01 - 08-Jan-31 Ex:Travel:Airfare $222.19 $8,810.04
-08-Aug-01 - 08-Aug-31 Ex:Travel:Passport $170.00 $8,980.04
+08-Dec-01 - 08-Dec-31 Expens:Travel:Passport $254.00 $8,587.85
+08-Jan-01 - 08-Jan-31 Expense:Travel:Airfare $222.19 $8,810.04
+08-Aug-01 - 08-Aug-31 Expens:Travel:Passport $170.00 $8,980.04
Liabilities:MasterCard $-170.00 $8,810.04
08-Jan-01 - 08-Jan-31 Liabilities:MasterCard $-222.19 $8,587.85
08-Dec-01 - 08-Dec-31 Assets:Checking $-254.00 $8,333.85
diff --git a/test/baseline/opt-sort-xacts.test b/test/baseline/opt-sort-xacts.test
index 4882e18f..5dee9775 100644
--- a/test/baseline/opt-sort-xacts.test
+++ b/test/baseline/opt-sort-xacts.test
@@ -86,27 +86,27 @@ reg --sort=account
>>>1
08-Dec-26 U.S. Department of .. Assets:Checking $-127.00 $-127.00
08-Dec-26 U.S. Department of .. Assets:Checking $-127.00 $-254.00
-08-Jan-11 LIAT Ex:Travel:Airfare $40.00 $-214.00
-08-Jan-14 cheaptickets.com Ex:Travel:Airfare $182.19 $-31.81
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $206.99
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $445.79
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $1,677.39
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $2,908.99
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,064.85
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,220.71
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $3,657.92
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $4,095.13
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $5,007.73
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $5,920.33
-08-Sep-22 AGNT FEE Ex:Travel:Airfare $70.00 $5,990.33
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $6,796.53
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $7,602.73
-08-Sep-22 LIAT 1974 LIMITED Ex:Travel:Airfare $418.34 $8,021.07
+08-Jan-11 LIAT Expense:Travel:Airfare $40.00 $-214.00
+08-Jan-14 cheaptickets.com Expense:Travel:Airfare $182.19 $-31.81
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $206.99
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $445.79
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $1,677.39
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $2,908.99
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,064.85
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,220.71
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $3,657.92
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $4,095.13
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $5,007.73
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $5,920.33
+08-Sep-22 AGNT FEE Expense:Travel:Airfare $70.00 $5,990.33
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $6,796.53
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $7,602.73
+08-Sep-22 LIAT 1974 LIMITED Expense:Travel:Airfare $418.34 $8,021.07
08-Feb-05 CTX Expenses:Travel:Auto $240.38 $8,261.45
08-Feb-22 BUDGET RENT-A-CAR Expenses:Travel:Auto $40.59 $8,302.04
-08-Aug-08 BCIS I-131 FILING F.. Ex:Travel:Passport $170.00 $8,472.04
-08-Dec-26 U.S. Department of .. Ex:Travel:Passport $127.00 $8,599.04
-08-Dec-26 U.S. Department of .. Ex:Travel:Passport $127.00 $8,726.04
+08-Aug-08 BCIS I-131 FILING F.. Expens:Travel:Passport $170.00 $8,472.04
+08-Dec-26 U.S. Department of .. Expens:Travel:Passport $127.00 $8,599.04
+08-Dec-26 U.S. Department of .. Expens:Travel:Passport $127.00 $8,726.04
08-Jan-11 LIAT Liabilities:MasterCard $-40.00 $8,686.04
08-Jan-14 cheaptickets.com Liabilities:MasterCard $-182.19 $8,503.85
08-Feb-05 CTX Liabilities:MasterCard $-240.38 $8,263.47
@@ -130,47 +130,47 @@ reg --sort=account
=== 0
reg --sort-xacts=account
>>>1
-08-Jan-11 LIAT Ex:Travel:Airfare $40.00 $40.00
+08-Jan-11 LIAT Expense:Travel:Airfare $40.00 $40.00
Liabilities:MasterCard $-40.00 0
-08-Jan-14 cheaptickets.com Ex:Travel:Airfare $182.19 $182.19
+08-Jan-14 cheaptickets.com Expense:Travel:Airfare $182.19 $182.19
Liabilities:MasterCard $-182.19 0
08-Feb-05 CTX Expenses:Travel:Auto $240.38 $240.38
Liabilities:MasterCard $-240.38 0
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $238.80
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $238.80
Liabilities:MasterCard $-238.80 0
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $238.80
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $238.80
Liabilities:MasterCard $-238.80 0
08-Feb-22 BUDGET RENT-A-CAR Expenses:Travel:Auto $40.59 $40.59
Liabilities:MasterCard $-40.59 0
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $1,231.60
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $1,231.60
Liabilities:MasterCard $-1,231.60 0
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $1,231.60
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $1,231.60
Liabilities:MasterCard $-1,231.60 0
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $155.86
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $155.86
Liabilities:MasterCard $-155.86 0
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $155.86
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $155.86
Liabilities:MasterCard $-155.86 0
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $437.21
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $437.21
Liabilities:MasterCard $-437.21 0
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $437.21
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $437.21
Liabilities:MasterCard $-437.21 0
-08-Aug-08 BCIS I-131 FILING F.. Ex:Travel:Passport $170.00 $170.00
+08-Aug-08 BCIS I-131 FILING F.. Expens:Travel:Passport $170.00 $170.00
Liabilities:MasterCard $-170.00 0
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $912.60
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $912.60
Liabilities:MasterCard $-912.60 0
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $912.60
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $912.60
Liabilities:MasterCard $-912.60 0
-08-Sep-22 AGNT FEE Ex:Travel:Airfare $70.00 $70.00
+08-Sep-22 AGNT FEE Expense:Travel:Airfare $70.00 $70.00
Liabilities:MasterCard $-70.00 0
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $806.20
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $806.20
Liabilities:MasterCard $-806.20 0
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $806.20
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $806.20
Liabilities:MasterCard $-806.20 0
-08-Sep-22 LIAT 1974 LIMITED Ex:Travel:Airfare $418.34 $418.34
+08-Sep-22 LIAT 1974 LIMITED Expense:Travel:Airfare $418.34 $418.34
Liabilities:MasterCard $-418.34 0
08-Dec-26 U.S. Department of .. Assets:Checking $-127.00 $-127.00
- Ex:Travel:Passport $127.00 0
+ Expens:Travel:Passport $127.00 0
08-Dec-26 U.S. Department of .. Assets:Checking $-127.00 $-127.00
- Ex:Travel:Passport $127.00 0
+ Expens:Travel:Passport $127.00 0
>>>2
=== 0
diff --git a/test/baseline/opt-sort.test b/test/baseline/opt-sort.test
index 27efe31b..6e9e5ddd 100644
--- a/test/baseline/opt-sort.test
+++ b/test/baseline/opt-sort.test
@@ -84,82 +84,82 @@ reg airfare --sort=date
Expenses:Travel:Passport $127.00
Assets:Checking
>>>1
-08-Jan-11 LIAT Ex:Travel:Airfare $40.00 $40.00
-08-Jan-14 cheaptickets.com Ex:Travel:Airfare $182.19 $222.19
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $460.99
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $699.79
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $1,931.39
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $3,162.99
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,318.85
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,474.71
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $3,911.92
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $4,349.13
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $5,261.73
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $6,174.33
-08-Sep-22 AGNT FEE Ex:Travel:Airfare $70.00 $6,244.33
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $7,050.53
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $7,856.73
-08-Sep-22 LIAT 1974 LIMITED Ex:Travel:Airfare $418.34 $8,275.07
+08-Jan-11 LIAT Expense:Travel:Airfare $40.00 $40.00
+08-Jan-14 cheaptickets.com Expense:Travel:Airfare $182.19 $222.19
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $460.99
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $699.79
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $1,931.39
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $3,162.99
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,318.85
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,474.71
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $3,911.92
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $4,349.13
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $5,261.73
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $6,174.33
+08-Sep-22 AGNT FEE Expense:Travel:Airfare $70.00 $6,244.33
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $7,050.53
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $7,856.73
+08-Sep-22 LIAT 1974 LIMITED Expense:Travel:Airfare $418.34 $8,275.07
>>>2
=== 0
reg airfare --sort=date,amount
>>>1
-08-Jan-11 LIAT Ex:Travel:Airfare $40.00 $40.00
-08-Jan-14 cheaptickets.com Ex:Travel:Airfare $182.19 $222.19
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $460.99
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $699.79
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $1,931.39
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $3,162.99
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,318.85
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,474.71
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $3,911.92
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $4,349.13
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $5,261.73
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $6,174.33
-08-Sep-22 AGNT FEE Ex:Travel:Airfare $70.00 $6,244.33
-08-Sep-22 LIAT 1974 LIMITED Ex:Travel:Airfare $418.34 $6,662.67
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $7,468.87
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $8,275.07
+08-Jan-11 LIAT Expense:Travel:Airfare $40.00 $40.00
+08-Jan-14 cheaptickets.com Expense:Travel:Airfare $182.19 $222.19
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $460.99
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $699.79
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $1,931.39
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $3,162.99
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,318.85
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,474.71
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $3,911.92
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $4,349.13
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $5,261.73
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $6,174.33
+08-Sep-22 AGNT FEE Expense:Travel:Airfare $70.00 $6,244.33
+08-Sep-22 LIAT 1974 LIMITED Expense:Travel:Airfare $418.34 $6,662.67
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $7,468.87
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $8,275.07
>>>2
=== 0
reg airfare --sort=date,-amount
>>>1
-08-Jan-11 LIAT Ex:Travel:Airfare $40.00 $40.00
-08-Jan-14 cheaptickets.com Ex:Travel:Airfare $182.19 $222.19
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $460.99
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $699.79
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $1,931.39
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $3,162.99
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,318.85
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,474.71
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $3,911.92
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $4,349.13
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $5,261.73
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $6,174.33
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $6,980.53
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $7,786.73
-08-Sep-22 LIAT 1974 LIMITED Ex:Travel:Airfare $418.34 $8,205.07
-08-Sep-22 AGNT FEE Ex:Travel:Airfare $70.00 $8,275.07
+08-Jan-11 LIAT Expense:Travel:Airfare $40.00 $40.00
+08-Jan-14 cheaptickets.com Expense:Travel:Airfare $182.19 $222.19
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $460.99
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $699.79
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $1,931.39
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $3,162.99
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,318.85
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,474.71
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $3,911.92
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $4,349.13
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $5,261.73
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $6,174.33
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $6,980.53
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $7,786.73
+08-Sep-22 LIAT 1974 LIMITED Expense:Travel:Airfare $418.34 $8,205.07
+08-Sep-22 AGNT FEE Expense:Travel:Airfare $70.00 $8,275.07
>>>2
=== 0
reg airfare --sort=-date,-amount
>>>1
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $806.20
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $1,612.40
-08-Sep-22 LIAT 1974 LIMITED Ex:Travel:Airfare $418.34 $2,030.74
-08-Sep-22 AGNT FEE Ex:Travel:Airfare $70.00 $2,100.74
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $3,013.34
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $3,925.94
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $4,363.15
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $4,800.36
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $4,956.22
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $5,112.08
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $6,343.68
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $7,575.28
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $7,814.08
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $8,052.88
-08-Jan-14 cheaptickets.com Ex:Travel:Airfare $182.19 $8,235.07
-08-Jan-11 LIAT Ex:Travel:Airfare $40.00 $8,275.07
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $806.20
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $1,612.40
+08-Sep-22 LIAT 1974 LIMITED Expense:Travel:Airfare $418.34 $2,030.74
+08-Sep-22 AGNT FEE Expense:Travel:Airfare $70.00 $2,100.74
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $3,013.34
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $3,925.94
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $4,363.15
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $4,800.36
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $4,956.22
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $5,112.08
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $6,343.68
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $7,575.28
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $7,814.08
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $8,052.88
+08-Jan-14 cheaptickets.com Expense:Travel:Airfare $182.19 $8,235.07
+08-Jan-11 LIAT Expense:Travel:Airfare $40.00 $8,275.07
>>>2
=== 0
bal --sort=total
@@ -202,27 +202,27 @@ reg --sort=account
>>>1
08-Dec-26 U.S. Department of .. Assets:Checking $-127.00 $-127.00
08-Dec-26 U.S. Department of .. Assets:Checking $-127.00 $-254.00
-08-Jan-11 LIAT Ex:Travel:Airfare $40.00 $-214.00
-08-Jan-14 cheaptickets.com Ex:Travel:Airfare $182.19 $-31.81
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $206.99
-08-Feb-05 UNITED Ex:Travel:Airfare $238.80 $445.79
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $1,677.39
-08-Mar-16 IBERIA Ex:Travel:Airfare $1,231.60 $2,908.99
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,064.85
-08-Apr-03 AMERICAN Ex:Travel:Airfare $155.86 $3,220.71
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $3,657.92
-08-Apr-30 UNITED Ex:Travel:Airfare $437.21 $4,095.13
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $5,007.73
-08-Sep-06 AMERICAN Ex:Travel:Airfare $912.60 $5,920.33
-08-Sep-22 AGNT FEE Ex:Travel:Airfare $70.00 $5,990.33
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $6,796.53
-08-Sep-22 DELTA Ex:Travel:Airfare $806.20 $7,602.73
-08-Sep-22 LIAT 1974 LIMITED Ex:Travel:Airfare $418.34 $8,021.07
+08-Jan-11 LIAT Expense:Travel:Airfare $40.00 $-214.00
+08-Jan-14 cheaptickets.com Expense:Travel:Airfare $182.19 $-31.81
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $206.99
+08-Feb-05 UNITED Expense:Travel:Airfare $238.80 $445.79
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $1,677.39
+08-Mar-16 IBERIA Expense:Travel:Airfare $1,231.60 $2,908.99
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,064.85
+08-Apr-03 AMERICAN Expense:Travel:Airfare $155.86 $3,220.71
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $3,657.92
+08-Apr-30 UNITED Expense:Travel:Airfare $437.21 $4,095.13
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $5,007.73
+08-Sep-06 AMERICAN Expense:Travel:Airfare $912.60 $5,920.33
+08-Sep-22 AGNT FEE Expense:Travel:Airfare $70.00 $5,990.33
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $6,796.53
+08-Sep-22 DELTA Expense:Travel:Airfare $806.20 $7,602.73
+08-Sep-22 LIAT 1974 LIMITED Expense:Travel:Airfare $418.34 $8,021.07
08-Feb-05 CTX Expenses:Travel:Auto $240.38 $8,261.45
08-Feb-22 BUDGET RENT-A-CAR Expenses:Travel:Auto $40.59 $8,302.04
-08-Aug-08 BCIS I-131 FILING F.. Ex:Travel:Passport $170.00 $8,472.04
-08-Dec-26 U.S. Department of .. Ex:Travel:Passport $127.00 $8,599.04
-08-Dec-26 U.S. Department of .. Ex:Travel:Passport $127.00 $8,726.04
+08-Aug-08 BCIS I-131 FILING F.. Expens:Travel:Passport $170.00 $8,472.04
+08-Dec-26 U.S. Department of .. Expens:Travel:Passport $127.00 $8,599.04
+08-Dec-26 U.S. Department of .. Expens:Travel:Passport $127.00 $8,726.04
08-Jan-11 LIAT Liabilities:MasterCard $-40.00 $8,686.04
08-Jan-14 cheaptickets.com Liabilities:MasterCard $-182.19 $8,503.85
08-Feb-05 CTX Liabilities:MasterCard $-240.38 $8,263.47
diff --git a/test/baseline/opt-subtotal.test b/test/baseline/opt-subtotal.test
index 41defbc1..f2d9454f 100644
--- a/test/baseline/opt-subtotal.test
+++ b/test/baseline/opt-subtotal.test
@@ -85,9 +85,9 @@ reg --subtotal
Assets:Checking
>>>1
08-Jan-11 - 08-Dec-26 Assets:Checking $-254.00 $-254.00
- Ex:Travel:Airfare $8,275.07 $8,021.07
+ Expense:Travel:Airfare $8,275.07 $8,021.07
Expenses:Travel:Auto $280.97 $8,302.04
- Ex:Travel:Passport $424.00 $8,726.04
+ Expens:Travel:Passport $424.00 $8,726.04
Liabilities:MasterCard $-8,726.04 0
>>>2
=== 0
diff --git a/test/baseline/opt-total-width.test b/test/baseline/opt-total-width.test
index 1d7b8b94..bbcb549e 100644
--- a/test/baseline/opt-total-width.test
+++ b/test/baseline/opt-total-width.test
@@ -4,8 +4,8 @@ reg --total-width=25
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
- In:Di:Vanguard:VMMXX $-0.35 $-0.35
+07-Feb-02 RD VMMXX As:Investm:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Dividen:Vanguar:VMMXX $-0.35 $-0.35
0.350 VMMXX
>>>2
=== 0
diff --git a/test/baseline/opt-total.test b/test/baseline/opt-total.test
index 8f4719d2..c73614c1 100644
--- a/test/baseline/opt-total.test
+++ b/test/baseline/opt-total.test
@@ -4,7 +4,7 @@ reg --total=10
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
-07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 10
- In:Di:Vanguard:VMMXX $-0.35 10
+07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 10
+ In:Divid:Vanguar:VMMXX $-0.35 10
>>>2
=== 0
diff --git a/test/regress/04C5E1CA.test b/test/regress/04C5E1CA.test
index 729ae6bf..9aca9b1f 100644
--- a/test/regress/04C5E1CA.test
+++ b/test/regress/04C5E1CA.test
@@ -8,10 +8,10 @@ reg
Expenses:School:CS Club:Home Depot:4" Brush (2 * $3.97)
Liabilities:Mastercard
>>>1
-09-Apr-04 CS Club Sign Ex:Sc:CS:Ho:4" Brush 2 2
+09-Apr-04 CS Club Sign Ex:Sc:CS:Home:4" Brush 2 2
Liabilities:Mastercard $-7.94 2
$-7.94
-09-Apr-04 CS Club Sign Ex:Sc:CS:Ho:4" Brush $7.94 2
+09-Apr-04 CS Club Sign Ex:Sc:CS:Home:4" Brush $7.94 2
Liabilities:Mastercard $-7.94 2
$-7.94
>>>2
diff --git a/test/regress/727B2DF8.test b/test/regress/727B2DF8.test
index a13e8292..fbe42e54 100644
--- a/test/regress/727B2DF8.test
+++ b/test/regress/727B2DF8.test
@@ -46,9 +46,9 @@ N $
; :AnotherTag:
>>>1
04-May-01 Checking balance Assets:Bank:Checking  $1,000.00 $1,000.00
- Eq:Opening Balances  $-1,000.00 0
+ Equit:Opening Balances $-1,000.00 0
04-May-03 Investment balance Assets:Brokerage  50 AAPL 50 AAPL
- Eq:Opening Balances  $-1,500.00 $-1,500.00
+ Equit:Opening Balances $-1,500.00 $-1,500.00
50 AAPL
04-May-14 Páy dày Assets:Bank:Checking  500.00€ $-1,500.00
50 AAPL
@@ -59,7 +59,7 @@ N $
50 AAPL
Income:Salary  $-500.00 $-1,500.00
50 AAPL
-04-May-14 Another dày in whic.. Ру:Ру:Ру:Русский язык  $1,000.00 $-500.00
+04-May-14 Another dày in whic.. Ру:Ру:Рус:Русский язык $1,000.00 $-500.00
50 AAPL
Income:Salary  $-1,000.00 $-1,500.00
50 AAPL
diff --git a/test/regress/86D2BDC4.test b/test/regress/86D2BDC4.test
index b6d4083c..1ea9fc41 100644
--- a/test/regress/86D2BDC4.test
+++ b/test/regress/86D2BDC4.test
@@ -5,7 +5,7 @@ reg -B
Expenses:Bank:Fees 2.73
Liabilities:Mastercard
>>>1
-09-Jun-03 Westjet Ex:Transportation:Air 676.017377 676.017377
+09-Jun-03 Westjet Expen:Transportati:Air 676.017377 676.017377
Expenses:Bank:Fees 2.73 678.747377
Liabilities:Mastercard -678.747377 0
>>>2
diff --git a/test/regress/D943AE0F.test b/test/regress/D943AE0F.test
index 7a2e14d8..8fd5f932 100644
--- a/test/regress/D943AE0F.test
+++ b/test/regress/D943AE0F.test
@@ -8,7 +8,7 @@ D 1000.00 EUR
P 2008/04/20 00:00:00 CAD 1.20 EUR
>>>1
-08-Apr-15 Paid expenses back .. Ex:Cie-Reimbursements 2200.00 EUR 2200.00 EUR
+08-Apr-15 Paid expenses back .. Exp:Cie-Reimbursements 2200.00 EUR 2200.00 EUR
Assets:Checking -2200.00 EUR 0
08-Apr-20 Commodities revalued <Revalued> 200.00 EUR 200.00 EUR
>>>2
diff --git a/test/regress/E4C9A8EA.test b/test/regress/E4C9A8EA.test
index fed47c82..108fb661 100644
--- a/test/regress/E4C9A8EA.test
+++ b/test/regress/E4C9A8EA.test
@@ -10,15 +10,15 @@ reg
Assets:Investments:RBC-Broker:Account-RSP 72.06 CAD
Expenses:Financial:Fees
>>>1
-07-Dec-31 Cost basis for: RED.. As:In:RB:Account-RSP 4.00 RHT 4.00 RHT
- Eq:Op:Cost -689.87 CAD -689.87 CAD
+07-Dec-31 Cost basis for: RED.. As:In:RBC-:Account-RSP 4.00 RHT 4.00 RHT
+ Equ:Opening-Balan:Cost -689.87 CAD -689.87 CAD
4.00 RHT
-08-Jan-03 Sell -- RHT -- RED .. As:In:RB:Account-RSP -4.00 RHT -689.87 CAD
- Ex:Fi:Commissions 9.95 USD -689.87 CAD
+08-Jan-03 Sell -- RHT -- RED .. As:In:RBC-:Account-RSP -4.00 RHT -689.87 CAD
+ Ex:Financi:Commissions 9.95 USD -689.87 CAD
9.95 USD
- As:In:RB:Account-RSP 72.06 CAD -617.81 CAD
+ As:In:RBC-:Account-RSP 72.06 CAD -617.81 CAD
9.95 USD
- Ex:Financial:Fees 2.89 CAD -614.92 CAD
+ Expense:Financial:Fees 2.89 CAD -614.92 CAD
9.95 USD
>>>2
=== 0
diff --git a/test/regress/E627C594.test b/test/regress/E627C594.test
index 0dfbf778..ba48a0c7 100644
--- a/test/regress/E627C594.test
+++ b/test/regress/E627C594.test
@@ -10,6 +10,8 @@ reg --forecast-while="d<[2010/03/01]" --now=2009/11/01
>>>1
09-Nov-01 Sample Expenses:Food:Dining $20.00 $20.00
Assets $-20.00 0
+09-Dec-01 Forecast transaction Expenses:Food $500.00 $500.00
+09-Dec-01 Forecast transaction Assets $-500.00 0
10-Jan-01 Forecast transaction Expenses:Food $500.00 $500.00
10-Jan-01 Forecast transaction Assets $-500.00 0
10-Feb-01 Forecast transaction Expenses:Food $500.00 $500.00
diff --git a/tools/Makefile.am b/tools/Makefile.am
index fa83c1ca..87f518eb 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -59,6 +59,7 @@ libledger_data_la_SOURCES = \
src/iterators.cc \
src/timelog.cc \
src/textual.cc \
+ src/temps.cc \
src/journal.cc \
src/archive.cc \
src/account.cc \
@@ -82,7 +83,6 @@ libledger_report_la_SOURCES = \
src/precmd.cc \
src/chain.cc \
src/filters.cc \
- src/temps.cc \
src/report.cc \
src/session.cc
@@ -124,6 +124,7 @@ pkginclude_HEADERS = \
src/xact.h \
src/account.h \
src/journal.h \
+ src/temps.h \
src/archive.h \
src/timelog.h \
src/iterators.h \
@@ -133,7 +134,6 @@ pkginclude_HEADERS = \
src/session.h \
src/report.h \
src/filters.h \
- src/temps.h \
src/chain.h \
src/precmd.h \
src/csv.h \
diff --git a/tools/speed-test.sh b/tools/speed-test.sh
new file mode 100755
index 00000000..0139a11d
--- /dev/null
+++ b/tools/speed-test.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -e
+
+cd ~/src/ledger
+/bin/rm -fr ~/Products/ledger/opt
+./acprep --no-python -j16 opt make check
+
+COMMIT=$(git describe --long --all)
+
+SPEEDS=$(./acprep --no-python -j16 opt make speedtest 2>&1 \
+ | grep "Finished executing command" \
+ | awk '{print $1}' \
+ | xargs)
+
+echo $COMMIT,$(echo $SPEEDS | sed 's/ /,/g') >> speed.log
+
+exit 0