Regular expressions supplied after 'reg' or 'bal' are working again.
This commit is contained in:
parent
7ffb6c472c
commit
548a03e725
4 changed files with 26 additions and 27 deletions
16
src/main.cc
16
src/main.cc
|
|
@ -164,20 +164,16 @@ namespace ledger {
|
|||
|
||||
value_t operator()(call_scope_t& args)
|
||||
{
|
||||
report_t& report(find_scope<report_t>(args));
|
||||
var_t<string> format(args, format_name);
|
||||
report_t& report(find_scope<report_t>(args));
|
||||
var_t<string> format(args, format_name);
|
||||
|
||||
if (! report.format_string.empty())
|
||||
*format = report.format_string;
|
||||
|
||||
if (args.value().is_sequence() &&
|
||||
args.value().size() > 1) {
|
||||
if (! report.predicate.empty())
|
||||
report.predicate = string("(") + report.predicate + ")&";
|
||||
report.predicate +=
|
||||
args_to_predicate(++args.value().as_sequence().begin(),
|
||||
args.value().as_sequence().end());
|
||||
}
|
||||
if (args.value().size() > 0)
|
||||
report.append_predicate
|
||||
(args_to_predicate(args.value().as_sequence().begin(),
|
||||
args.value().as_sequence().end()));
|
||||
|
||||
(report.*report_method)(handler_ptr(new Formatter(report, *format)));
|
||||
|
||||
|
|
|
|||
10
src/report.h
10
src/report.h
|
|
@ -619,10 +619,14 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
value_t option_limit_(call_scope_t& args) { // l:
|
||||
void append_predicate(const string& str) {
|
||||
if (! predicate.empty())
|
||||
predicate += "&";
|
||||
predicate += args[0].as_string();
|
||||
predicate = string("(") + predicate + ")&";
|
||||
predicate += str;
|
||||
}
|
||||
|
||||
value_t option_limit_(call_scope_t& args) { // l:
|
||||
append_predicate(args[0].as_string());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,9 +157,11 @@ public:
|
|||
}
|
||||
|
||||
void set_args(const value_t& _args) {
|
||||
assert(_args.is_sequence());
|
||||
args = _args;
|
||||
}
|
||||
value_t& value() {
|
||||
assert(args.is_null() || args.is_sequence());
|
||||
return args;
|
||||
}
|
||||
|
||||
|
|
|
|||
25
src/value.h
25
src/value.h
|
|
@ -803,20 +803,17 @@ public:
|
|||
|
||||
void push_back(const value_t& val) {
|
||||
if (! val.is_null()) {
|
||||
if (is_null()) {
|
||||
*this = val;
|
||||
} else {
|
||||
if (! is_sequence())
|
||||
in_place_cast(SEQUENCE);
|
||||
if (is_null())
|
||||
*this = sequence_t();
|
||||
if (! is_sequence())
|
||||
in_place_cast(SEQUENCE);
|
||||
|
||||
if (! val.is_sequence()) {
|
||||
if (! val.is_null())
|
||||
as_sequence_lval().push_back(val);
|
||||
} else {
|
||||
const value_t::sequence_t& val_seq(val.as_sequence());
|
||||
std::copy(val_seq.begin(), val_seq.end(),
|
||||
back_inserter(as_sequence_lval()));
|
||||
}
|
||||
if (! val.is_sequence()) {
|
||||
as_sequence_lval().push_back(val);
|
||||
} else {
|
||||
const sequence_t& val_seq(val.as_sequence());
|
||||
std::copy(val_seq.begin(), val_seq.end(),
|
||||
back_inserter(as_sequence_lval()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -829,7 +826,7 @@ public:
|
|||
} else {
|
||||
as_sequence_lval().pop_back();
|
||||
|
||||
const value_t::sequence_t& seq(as_sequence());
|
||||
const sequence_t& seq(as_sequence());
|
||||
std::size_t new_size = seq.size();
|
||||
if (new_size == 0)
|
||||
_reset();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue