- ::findMissingOperators now detects all locations where a logicl operator
  is needed.
This commit is contained in:
Paul Beckingham 2014-05-21 00:03:05 -04:00
parent c9a94f0205
commit 2f46c5de31

View file

@ -1367,6 +1367,14 @@ void A3t::findPlainArgs ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Two consecutive FILTER, non-OP arguments that are not "(" or ")" need an
// "and" operator inserted between them.
//
// ) <non-op> --> ) and <non-op>
// <non-op> ( --> <non-op> <and> (
// ) ( --> ) and (
// <non-op> <non-op> --> <non-op> and <non-op>
//
void A3t::findMissingOperators () void A3t::findMissingOperators ()
{ {
std::vector <Tree*>::iterator prev = _tree->_branches.begin (); std::vector <Tree*>::iterator prev = _tree->_branches.begin ();
@ -1375,27 +1383,47 @@ void A3t::findMissingOperators ()
{ {
if ((*i)->hasTag ("FILTER") && ! (*i)->hasTag ("PSEUDO")) if ((*i)->hasTag ("FILTER") && ! (*i)->hasTag ("PSEUDO"))
{ {
// Two consecutive FILTER, non-OP arguments that are not "(" or ")" need if ((*i)->_branches.size ())
// an "and" operator inserted between them.
//
// ) <non-op> --> ) and <non-op>
// <non-op> ( --> <non-op> <and> (
// ) ( --> ) and (
// <non-op> <non-op> --> <non-op> and <non-op>
//
if (i != prev &&
(((*prev)->hasTag ("FILTER") && ! (*prev)->hasTag ("OP")) || (*prev)->attribute ("raw") == ")") &&
(! (*i)->hasTag ("OP") || (*i)->attribute ("raw") == "("))
{ {
std::cout << "# missingOperator '" std::vector <Tree*>::iterator sub;
<< (*prev)->attribute ("raw") for (sub = (*i)->_branches.begin (); sub != (*i)->_branches.end (); ++sub)
<< " " {
<< (*i)->attribute ("raw") if (sub != prev &&
<< "' --> '" (((*prev)->hasTag ("FILTER") && ! (*prev)->hasTag ("OP")) || (*prev)->attribute ("raw") == ")") &&
<< (*prev)->attribute ("raw") (! (*sub)->hasTag ("OP") || (*sub)->attribute ("raw") == "("))
<< " and " {
<< (*i)->attribute ("raw") std::cout << "# missingOperator '"
<< "'\n"; << (*prev)->attribute ("raw")
<< " "
<< (*sub)->attribute ("raw")
<< "' --> '"
<< (*prev)->attribute ("raw")
<< " and "
<< (*sub)->attribute ("raw")
<< "'\n";
}
prev = sub;
}
}
else
{
if (i != prev &&
(((*prev)->hasTag ("FILTER") && ! (*prev)->hasTag ("OP")) || (*prev)->attribute ("raw") == ")") &&
(! (*i)->hasTag ("OP") || (*i)->attribute ("raw") == "("))
{
std::cout << "# missingOperator '"
<< (*prev)->attribute ("raw")
<< " "
<< (*i)->attribute ("raw")
<< "' --> '"
<< (*prev)->attribute ("raw")
<< " and "
<< (*i)->attribute ("raw")
<< "'\n";
}
prev = i;
} }
} }
} }