From e27ba3e1ff77537ade8287f1d66cf6fe626c8962 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 18 Nov 2009 23:15:22 -0500 Subject: It's OK for a report query to be empty It's always possible the user only specified a display predicate. --- src/precmd.cc | 24 ++++++++++-------------- src/report.cc | 24 ++++++++++-------------- 2 files changed, 20 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/precmd.cc b/src/precmd.cc index 516b90dd..31249016 100644 --- a/src/precmd.cc +++ b/src/precmd.cc @@ -184,14 +184,12 @@ value_t args_command(call_scope_t& args) out << std::endl << std::endl; query_t query(args.value(), report.what_to_keep()); - if (! query) - throw_(std::runtime_error, - _("Invalid query predicate: %1") << join_args(args)); + if (query) { + call_scope_t sub_args(static_cast(args)); + sub_args.push_back(string_value(query.text())); - call_scope_t sub_args(static_cast(args)); - sub_args.push_back(string_value(query.text())); - - parse_command(sub_args); + parse_command(sub_args); + } if (query.tokens_remaining()) { out << std::endl << _("====== Display predicate ======") @@ -199,14 +197,12 @@ value_t args_command(call_scope_t& args) query.parse_again(); - if (! query) - throw_(std::runtime_error, - _("Invalid display predicate: %1") << join_args(args)); + if (query) { + call_scope_t disp_sub_args(static_cast(args)); + disp_sub_args.push_back(string_value(query.text())); - call_scope_t disp_sub_args(static_cast(args)); - disp_sub_args.push_back(string_value(query.text())); - - parse_command(disp_sub_args); + parse_command(disp_sub_args); + } } return NULL_VALUE; diff --git a/src/report.cc b/src/report.cc index 78ed05c0..ed3238bc 100644 --- a/src/report.cc +++ b/src/report.cc @@ -222,25 +222,21 @@ void report_t::normalize_options(const string& verb) void report_t::parse_query_args(const value_t& args, const string& whence) { query_t query(args, what_to_keep()); - if (! query) - throw_(std::runtime_error, - _("Invalid query predicate: %1") << query.text()); + if (query) { + HANDLER(limit_).on(whence, query.text()); - HANDLER(limit_).on(whence, query.text()); - - DEBUG("report.predicate", - "Predicate = " << HANDLER(limit_).str()); + DEBUG("report.predicate", + "Predicate = " << HANDLER(limit_).str()); + } if (query.tokens_remaining()) { query.parse_again(); - if (! query) - throw_(std::runtime_error, - _("Invalid display predicate: %1") << query.text()); + if (query) { + HANDLER(display_).on(whence, query.text()); - HANDLER(display_).on(whence, query.text()); - - DEBUG("report.predicate", - "Display predicate = " << HANDLER(display_).str()); + DEBUG("report.predicate", + "Display predicate = " << HANDLER(display_).str()); + } } } -- cgit v1.2.3