From 6c0ba77204fad95ac8a0f3cbced7256c2cbf590c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 19 Jun 2015 10:15:01 -0700 Subject: [PATCH] CLI2: Added ::prepareFilter for the deferred parsing of filters --- src/CLI2.cpp | 9 ++++++++- src/CLI2.h | 1 + src/Filter.cpp | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index d0d7b01f5..5fb849512 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -668,11 +668,18 @@ const std::string CLI2::getFilter (bool applyContext) filter = "( " + filter + " )"; } - context.debug("Derived filter: '" + filter + "'"); + context.debug("CLI2: Derived filter: '" + 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: // - BINARY diff --git a/src/CLI2.h b/src/CLI2.h index 935e6e71c..4e2ffdcc4 100644 --- a/src/CLI2.h +++ b/src/CLI2.h @@ -94,6 +94,7 @@ public: void applyOverrides (); const std::string getFilter (bool applyContext = true); */ + void prepareFilter (bool applyContext = true); const std::vector getWords (bool filtered = true); bool canonicalize (std::string&, const std::string&, const std::string&) const; std::string getBinary () const; diff --git a/src/Filter.cpp b/src/Filter.cpp index e2246c573..aebfbf535 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -72,6 +72,11 @@ void Filter::subset (const std::vector & input, std::vector & output context.timer_filter.start (); _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) context.debug (context.cli.dump ("Filter::subset")); @@ -114,6 +119,11 @@ void Filter::subset (std::vector & output, bool applyContext /* = true */) { 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) context.debug (context.cli.dump ("Filter::subset"));