mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Expression Operators
- Implemented operator_equal, operator_inequal. - Removed diagnostics for completed operators.
This commit is contained in:
parent
eb1154235a
commit
a26b4ca12f
2 changed files with 25 additions and 1 deletions
|
@ -815,6 +815,7 @@ const A3 A3::expand (const A3& input) const
|
|||
{
|
||||
A3 expanded;
|
||||
std::vector <Arg>::const_iterator arg;
|
||||
std::vector <Arg>::const_iterator previous = input.begin ();
|
||||
for (arg = input.begin (); arg != input.end (); ++arg)
|
||||
{
|
||||
// name:value --> name = value
|
||||
|
@ -950,7 +951,9 @@ const A3 A3::expand (const A3& input) const
|
|||
}
|
||||
|
||||
// word --> description ~ word
|
||||
else if (arg->_category == "word")
|
||||
// Note: use of previous prevents desc~foo --> desc~desc~foo
|
||||
else if (arg->_category == "word" &&
|
||||
previous->_category != "op")
|
||||
{
|
||||
expanded.push_back (Arg ("description", "dom"));
|
||||
expanded.push_back (Arg ("~", "op"));
|
||||
|
@ -971,6 +974,8 @@ const A3 A3::expand (const A3& input) const
|
|||
// Default --> preserve
|
||||
else
|
||||
expanded.push_back (*arg);
|
||||
|
||||
previous = arg;
|
||||
}
|
||||
|
||||
return expanded;
|
||||
|
|
19
src/E9.cpp
19
src/E9.cpp
|
@ -216,12 +216,14 @@ void E9::operator_and (Term& result, Term& left, Term& right)
|
|||
result._category = "bool";
|
||||
}
|
||||
|
||||
/*
|
||||
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
|
||||
<< " and "
|
||||
<< right._raw << "/" << right._value << "/" << right._category
|
||||
<< " --> "
|
||||
<< result._raw << "/" << result._value << "/" << result._category
|
||||
<< "\n";
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -238,12 +240,14 @@ void E9::operator_or (Term& result, Term& left, Term& right)
|
|||
result._category = "bool";
|
||||
}
|
||||
|
||||
/*
|
||||
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
|
||||
<< " or "
|
||||
<< right._raw << "/" << right._value << "/" << right._category
|
||||
<< " --> "
|
||||
<< result._raw << "/" << result._value << "/" << result._category
|
||||
<< "\n";
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -263,12 +267,14 @@ void E9::operator_xor (Term& result, Term& left, Term& right)
|
|||
result._category = "bool";
|
||||
}
|
||||
|
||||
/*
|
||||
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
|
||||
<< " xor "
|
||||
<< right._raw << "/" << right._value << "/" << right._category
|
||||
<< " --> "
|
||||
<< result._raw << "/" << result._value << "/" << result._category
|
||||
<< "\n";
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -344,13 +350,20 @@ void E9::operator_inequal (
|
|||
Term& right,
|
||||
bool case_sensitive)
|
||||
{
|
||||
operator_equal (result, left, right, case_sensitive);
|
||||
if (result._raw == "false")
|
||||
result._raw = result._value = "true";
|
||||
else
|
||||
result._raw = result._value = "false";
|
||||
|
||||
/*
|
||||
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
|
||||
<< " != "
|
||||
<< right._raw << "/" << right._value << "/" << right._category
|
||||
<< " --> "
|
||||
<< result._raw << "/" << result._value << "/" << result._category
|
||||
<< "\n";
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -397,12 +410,14 @@ void E9::operator_equal (
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
|
||||
<< " = "
|
||||
<< right._raw << "/" << right._value << "/" << right._category
|
||||
<< " --> "
|
||||
<< result._raw << "/" << result._value << "/" << result._category
|
||||
<< "\n";
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -419,12 +434,14 @@ void E9::operator_match (
|
|||
else
|
||||
result._raw = result._value = "false";
|
||||
|
||||
/*
|
||||
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
|
||||
<< " ~ "
|
||||
<< right._raw << "/" << right._value << "/" << right._category
|
||||
<< " --> "
|
||||
<< result._raw << "/" << result._value << "/" << result._category
|
||||
<< "\n";
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -451,12 +468,14 @@ void E9::operator_nomatch (
|
|||
else
|
||||
result._raw = result._value = "false";
|
||||
|
||||
/*
|
||||
std::cout << "# " << left._raw << "/" << left._value << "/" << left._category
|
||||
<< " !~ "
|
||||
<< right._raw << "/" << right._value << "/" << right._category
|
||||
<< " --> "
|
||||
<< result._raw << "/" << result._value << "/" << result._category
|
||||
<< "\n";
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue