E9 - operator_equal

- Added proper handling for missing dates to the '=' operator.  This
  is a trial run of enhancements to lots of other operators to come.
This commit is contained in:
Paul Beckingham 2011-08-21 14:33:10 -04:00
parent 2b961c128a
commit 6e976e7d7c

View file

@ -110,6 +110,7 @@ void E9::eval (const Task& task, std::vector <Arg>& value_stack)
operator_not (result, right); operator_not (result, right);
} }
/* /*
// TODO Unary -.
else if (arg->raw == "-") else if (arg->raw == "-")
{ {
} }
@ -153,9 +154,9 @@ void E9::eval (const Task& task, std::vector <Arg>& value_stack)
// Operand. // Operand.
else else
{ {
// Derive _value from _raw, and push on the stack.
Arg operand (*arg); Arg operand (*arg);
// Expand the value if possible.
if (operand._category == Arg::cat_dom && _dom) if (operand._category == Arg::cat_dom && _dom)
{ {
operand._value = context.dom.get (operand._raw, task); operand._value = context.dom.get (operand._raw, task);
@ -445,8 +446,10 @@ void E9::operator_equal (
} }
// Dates. // Dates.
else if (left._type == Arg::type_date || else if ((left._type == Arg::type_date ||
right._type == Arg::type_date) right._type == Arg::type_date) &&
left._value != "" &&
right._value != "")
{ {
// std::cout << "# date matching\n"; // std::cout << "# date matching\n";
Date left_date (left._value, _dateformat); Date left_date (left._value, _dateformat);