diff options
author | John Wiegley <johnw@newartisans.com> | 2010-05-08 02:06:06 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-05-08 02:06:06 -0400 |
commit | 4ec54b86f856c6e85446d065d2940b4244d71b8f (patch) | |
tree | 645c11578337991c7de83a4e3443a50b5c8a469a /src/generate.cc | |
parent | d5f8c3bc576d98266519911ec05a98cd586d49db (diff) | |
download | fork-ledger-4ec54b86f856c6e85446d065d2940b4244d71b8f.tar.gz fork-ledger-4ec54b86f856c6e85446d065d2940b4244d71b8f.tar.bz2 fork-ledger-4ec54b86f856c6e85446d065d2940b4244d71b8f.zip |
Added any() and all() value expression macros
any() matches an expression against every post in a transaction or
account, and returns true if any of them are true. all() tests if all
are true. For example:
ledger -l 'account =~ /Expense/ & any(account =~ /MasterCard/)' reg
This reports every posting affecting an Expense account (regex match),
but only if some other posting in the same transaction affects the
MasterCard account.
Both functions also take a second boolean argument. If it is false, the
"source" posting is not considered. For example:
ledger -l 'any(/x/, false)'
This matches any posting where a *different* posting in the same
transaction contains the letter 'x'.
Diffstat (limited to 'src/generate.cc')
-rw-r--r-- | src/generate.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/generate.cc b/src/generate.cc index c1eb1d14..9b4c2ee7 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -171,10 +171,10 @@ void generate_posts_iterator::generate_commodity(std::ostream& out) generate_string(buf, six_gen(), true); comm = buf.str(); } - while (comm == "h" || comm == "m" || comm == "s" || - comm == "and" || comm == "div" || comm == "false" || - comm == "or" || comm == "not" || comm == "true" || - comm == "if" || comm == "else"); + while (comm == "h" || comm == "m" || comm == "s" || comm == "and" || + comm == "any" || comm == "all" || comm == "div" || + comm == "false" || comm == "or" || comm == "not" || + comm == "true" || comm == "if" || comm == "else"); out << comm; } |