mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Eval
- Attempts named source resolution as part of primitive parsing.
This commit is contained in:
parent
52edc9b7cf
commit
d9e1607f05
1 changed files with 21 additions and 2 deletions
23
src/Eval.cpp
23
src/Eval.cpp
|
@ -693,7 +693,7 @@ bool Eval::parsePrimitive (
|
||||||
int &i) const
|
int &i) const
|
||||||
{
|
{
|
||||||
if (_debug)
|
if (_debug)
|
||||||
std::cout << "# parseVariant\n";
|
std::cout << "# parsePrimitive\n";
|
||||||
|
|
||||||
if (i < infix.size ())
|
if (i < infix.size ())
|
||||||
{
|
{
|
||||||
|
@ -718,7 +718,26 @@ bool Eval::parsePrimitive (
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (infix[i].second != Lexer::typeOperator)
|
bool found = false;
|
||||||
|
std::vector <bool (*)(const std::string&, Variant&)>::const_iterator source;
|
||||||
|
for (source = _sources.begin (); source != _sources.end (); ++source)
|
||||||
|
{
|
||||||
|
Variant v;
|
||||||
|
if ((*source) (infix[i].first, v))
|
||||||
|
{
|
||||||
|
if (_debug)
|
||||||
|
std::cout << "# " << infix[i].first << "' --> '" << (std::string) v << "'\n";
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (infix[i].second != Lexer::typeOperator)
|
||||||
{
|
{
|
||||||
if (_debug)
|
if (_debug)
|
||||||
std::cout << "# " << infix[i].first << "\n";
|
std::cout << "# " << infix[i].first << "\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue