Corrected a problem with parsing parens in argument query expressions.
This commit is contained in:
parent
4d8fba5fad
commit
e0fab726c6
1 changed files with 12 additions and 6 deletions
|
|
@ -100,6 +100,7 @@ string args_to_predicate_expr(value_t::sequence_t::const_iterator begin,
|
||||||
only_parenthesis = true;
|
only_parenthesis = true;
|
||||||
|
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
string parens;
|
||||||
|
|
||||||
for (const char * c = arg.c_str(); *c != '\0'; c++) {
|
for (const char * c = arg.c_str(); *c != '\0'; c++) {
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
|
@ -109,6 +110,14 @@ string args_to_predicate_expr(value_t::sequence_t::const_iterator begin,
|
||||||
|
|
||||||
if (in_prefix) {
|
if (in_prefix) {
|
||||||
switch (*c) {
|
switch (*c) {
|
||||||
|
case ')':
|
||||||
|
if (only_parenthesis)
|
||||||
|
only_closed_parenthesis = true;
|
||||||
|
// fall through...
|
||||||
|
case '(':
|
||||||
|
parens += c;
|
||||||
|
consumed = true;
|
||||||
|
break;
|
||||||
case '@':
|
case '@':
|
||||||
buf << "(payee =~ /";
|
buf << "(payee =~ /";
|
||||||
found_specifier = true;
|
found_specifier = true;
|
||||||
|
|
@ -142,13 +151,10 @@ string args_to_predicate_expr(value_t::sequence_t::const_iterator begin,
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ')':
|
|
||||||
if (only_parenthesis)
|
|
||||||
only_closed_parenthesis = true;
|
|
||||||
// fall_through...
|
|
||||||
default:
|
default:
|
||||||
if (! found_specifier) {
|
if (! found_specifier) {
|
||||||
buf << "(account =~ /";
|
buf << parens << "(account =~ /";
|
||||||
|
parens.clear();
|
||||||
found_specifier = true;
|
found_specifier = true;
|
||||||
}
|
}
|
||||||
in_prefix = false;
|
in_prefix = false;
|
||||||
|
|
@ -164,7 +170,7 @@ string args_to_predicate_expr(value_t::sequence_t::const_iterator begin,
|
||||||
! (only_parenthesis && only_closed_parenthesis))
|
! (only_parenthesis && only_closed_parenthesis))
|
||||||
expr << prefix;
|
expr << prefix;
|
||||||
|
|
||||||
expr << buf.str();
|
expr << parens << buf.str();
|
||||||
|
|
||||||
if (found_specifier) {
|
if (found_specifier) {
|
||||||
if (! no_final_slash)
|
if (! no_final_slash)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue