diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-09 14:50:19 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-09 14:50:19 -0400 |
commit | e0fab726c6e9e5e9ecc5b8cd6a7be2e8233826a6 (patch) | |
tree | e7d39fd3a6614fe06cfd9d081f27a55405da1f29 /src/predicate.cc | |
parent | 4d8fba5fadaf8db9d7b1e1ab77a2ecc1b894f282 (diff) | |
download | fork-ledger-e0fab726c6e9e5e9ecc5b8cd6a7be2e8233826a6.tar.gz fork-ledger-e0fab726c6e9e5e9ecc5b8cd6a7be2e8233826a6.tar.bz2 fork-ledger-e0fab726c6e9e5e9ecc5b8cd6a7be2e8233826a6.zip |
Corrected a problem with parsing parens in argument query expressions.
Diffstat (limited to 'src/predicate.cc')
-rw-r--r-- | src/predicate.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/predicate.cc b/src/predicate.cc index 12f7865c..e46b55c2 100644 --- a/src/predicate.cc +++ b/src/predicate.cc @@ -100,6 +100,7 @@ string args_to_predicate_expr(value_t::sequence_t::const_iterator begin, only_parenthesis = true; std::ostringstream buf; + string parens; for (const char * c = arg.c_str(); *c != '\0'; c++) { bool consumed = false; @@ -109,6 +110,14 @@ string args_to_predicate_expr(value_t::sequence_t::const_iterator begin, if (in_prefix) { switch (*c) { + case ')': + if (only_parenthesis) + only_closed_parenthesis = true; + // fall through... + case '(': + parens += c; + consumed = true; + break; case '@': buf << "(payee =~ /"; found_specifier = true; @@ -142,13 +151,10 @@ string args_to_predicate_expr(value_t::sequence_t::const_iterator begin, consumed = true; break; } - case ')': - if (only_parenthesis) - only_closed_parenthesis = true; - // fall_through... default: if (! found_specifier) { - buf << "(account =~ /"; + buf << parens << "(account =~ /"; + parens.clear(); found_specifier = true; } in_prefix = false; @@ -164,7 +170,7 @@ string args_to_predicate_expr(value_t::sequence_t::const_iterator begin, ! (only_parenthesis && only_closed_parenthesis)) expr << prefix; - expr << buf.str(); + expr << parens << buf.str(); if (found_specifier) { if (! no_final_slash) |