Expressions

- Broke out expression handling into two distinct flavors: filter
  and expression.  Filters need lots of preparation and mapping,
  which includes implicit 'AND' operators, expansion of syntactic
  sugar like /pattern/ etc and evaluate to a Boolean.  Expressions
  are simpler wiht less preparation, and evaluate to a Variant.
This commit is contained in:
Paul Beckingham
2011-07-17 12:04:38 -04:00
parent d66729adf3
commit e08d840ba1
6 changed files with 150 additions and 85 deletions

View File

@@ -41,6 +41,9 @@ public:
Expression (Arguments&);
~Expression ();
bool eval (const Task&);
bool evalFilter (const Task&);
std::string evalExpression (const Task&);
void eval (const Task&, std::vector <Variant>&);
private:
void expand_sequence ();
@@ -53,6 +56,7 @@ private:
void expand_tokens ();
void postfix ();
void tokenize (const std::string&, const std::string&, std::vector <std::string>&, Arguments&);
void create_variant (Variant&, const std::string&, const std::string&);
bool is_new_style ();
@@ -62,6 +66,7 @@ private:
private:
Arguments _args;
std::map <std::string, RX> _regexes;
bool _prepared;
};
#endif