CLI2: Added ::prepareFilter for the deferred parsing of filters

This commit is contained in:
Paul Beckingham 2015-06-19 10:15:01 -07:00
parent dc5f9e38a6
commit 6c0ba77204
3 changed files with 19 additions and 1 deletions

View file

@ -668,11 +668,18 @@ const std::string CLI2::getFilter (bool applyContext)
filter = "( " + filter + " )"; filter = "( " + filter + " )";
} }
context.debug("Derived filter: '" + filter + "'"); context.debug("CLI2: Derived filter: '" + filter + "'");
return filter; return filter;
} }
*/ */
////////////////////////////////////////////////////////////////////////////////
// Parset the commnad line, identifiying filter components, expanding syntactic
// sugar as necessary.
void CLI2::prepareFilter (bool applyContext)
{
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Get the original command line arguments, in pristine condition, but skipping: // Get the original command line arguments, in pristine condition, but skipping:
// - BINARY // - BINARY

View file

@ -94,6 +94,7 @@ public:
void applyOverrides (); void applyOverrides ();
const std::string getFilter (bool applyContext = true); const std::string getFilter (bool applyContext = true);
*/ */
void prepareFilter (bool applyContext = true);
const std::vector <std::string> getWords (bool filtered = true); const std::vector <std::string> getWords (bool filtered = true);
bool canonicalize (std::string&, const std::string&, const std::string&) const; bool canonicalize (std::string&, const std::string&, const std::string&) const;
std::string getBinary () const; std::string getBinary () const;

View file

@ -72,6 +72,11 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
context.timer_filter.start (); context.timer_filter.start ();
_startCount = (int) input.size (); _startCount = (int) input.size ();
context.cli2.prepareFilter (applyContext);
// TODO Need to replace CLI2::getFilter with something that just walks the
// the parse tree. No point in combining the parse tree into a string,
// only to lex it back into tokens for Eval.
if (context.config.getInteger ("debug.parser") >= 1) if (context.config.getInteger ("debug.parser") >= 1)
context.debug (context.cli.dump ("Filter::subset")); context.debug (context.cli.dump ("Filter::subset"));
@ -114,6 +119,11 @@ void Filter::subset (std::vector <Task>& output, bool applyContext /* = true */)
{ {
context.timer_filter.start (); context.timer_filter.start ();
context.cli2.prepareFilter (applyContext);
// TODO Need to replace CLI2::getFilter with something that just walks the
// the parse tree. No point in combining the parse tree into a string,
// only to lex it back into tokens for Eval.
if (context.config.getInteger ("debug.parser") >= 1) if (context.config.getInteger ("debug.parser") >= 1)
context.debug (context.cli.dump ("Filter::subset")); context.debug (context.cli.dump ("Filter::subset"));