diff options
author | John Wiegley <johnw@newartisans.com> | 2010-03-10 03:56:34 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-03-10 03:56:34 -0500 |
commit | 7e719c42dc1464fdef1fe54ac7287e1eca60f44d (patch) | |
tree | 5c4c14ebc4b93865f15465b5fdf7f08f9628bd7c | |
parent | 25c72d6e23dc93cc590e73327238368245cdcd9c (diff) | |
download | fork-ledger-7e719c42dc1464fdef1fe54ac7287e1eca60f44d.tar.gz fork-ledger-7e719c42dc1464fdef1fe54ac7287e1eca60f44d.tar.bz2 fork-ledger-7e719c42dc1464fdef1fe54ac7287e1eca60f44d.zip |
Extended regexp syntax for "payee" and "capture"
-rw-r--r-- | src/textual.cc | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/textual.cc b/src/textual.cc index dae9c3c6..6a8ea62e 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -742,7 +742,21 @@ void instance_t::payee_mapping_directive(char * line) char * payee = skip_ws(line); char * regex = next_element(payee, true); - context.journal.payee_mappings.push_back(payee_mapping_t(mask_t(regex), payee)); + if (regex) + context.journal.payee_mappings.push_back + (payee_mapping_t(mask_t(regex), payee)); + + while (peek_whitespace_line()) { + std::streamsize len = read_line(line); + assert(len > 0); + + regex = skip_ws(line); + if (! *regex) + break; + + context.journal.payee_mappings.push_back + (payee_mapping_t(mask_t(regex), payee)); + } } void instance_t::account_mapping_directive(char * line) @@ -750,9 +764,23 @@ void instance_t::account_mapping_directive(char * line) char * account_name = skip_ws(line); char * payee_regex = next_element(account_name, true); - context.journal.account_mappings.push_back - (account_mapping_t(mask_t(payee_regex), - context.top_account()->find_account(account_name))); + if (payee_regex) + context.journal.account_mappings.push_back + (account_mapping_t(mask_t(payee_regex), + context.top_account()->find_account(account_name))); + + while (peek_whitespace_line()) { + std::streamsize len = read_line(line); + assert(len > 0); + + payee_regex = skip_ws(line); + if (! *payee_regex) + break; + + context.journal.account_mappings.push_back + (account_mapping_t(mask_t(payee_regex), + context.top_account()->find_account(account_name))); + } } void instance_t::tag_directive(char * line) |