This is used to define the beginning/ending ranges of the time period,
before it becomes fixed (by calling stabilize()) and then sets the
values of start and end.
date_specifier_t ::
This is like a plain date_t, except it knows what wasn't specified.
For example, if 2008/06 is parsed, it becomes date_specifier_t which
knows that no day was given. If you ask for the begin() date of the
specifier, it will be 2008/06/01; the end() date (which is
exclusive) will be 2008/07/01.
date_range_t ::
A date range is a range of two specifiers, either of which (but not
both) may be omitted. This makes it possible to represent
expressions like "from june to july", where no day or year is given.
The exact dates will be inferred by using the current year, and
fixing the range from YEAR/06/01 to YEAR/07/01. That is, the range
goes from the begin() of one date specifier to the begin() of the
other.
date_specifier_or_range_t ::
A variadic type that can be either a date_specifier_t or a
date_range_t. It's just a wrapper to represent the fact that ranges
can be implicit via specifiers (such as, "in june"), or explicit via
ranges ("since 2008").
This reduces parsing time in the optimized build by 25%, and was a safe,
easy patch. If the "quick predicate evaluator" fails, we disable it
from that point on go back to what the standard code does.
This lets you run standard report queries against a Ledger journal and
get back a collection of postings, for example:
import ledger
journal = ledger.Journal("sample.dat")
posts = journal.collect("-M assets")
for post in posts:
print post.account
However, this code is not really working yet for a large variety of
reasons, having to do with object life-time, shallow copying, and lack
of reference counting where it should be. For instance, calling
ledger.Journal().collect() fails because the temporary journal object is
destroyed and the collection now has a host of bad pointers. Using "for
post in journal.collect()" fails too with other bad pointers. And the
whole lot of it crashes on exit at the moment.