/////////////////////////////////////////////////////////////////////////// Primitive --> "(" Logical ")" | Variant
| 563 | //////////////////////////////////////////////////////////////////////////////// |
| 564 | // Primitive --> "(" Logical ")" | Variant |
| 565 | bool Eval::parsePrimitive(std::vector<std::pair<std::string, Lexer::Type>>& infix, |
| 566 | unsigned int& i) const { |
| 567 | if (i < infix.size()) { |
| 568 | if (infix[i].first == "(") { |
| 569 | ++i; |
| 570 | if (i < infix.size() && parseLogical(infix, i)) { |
| 571 | if (i < infix.size() && infix[i].first == ")") { |
| 572 | ++i; |
| 573 | return true; |
| 574 | } |
| 575 | } |
| 576 | } else { |
| 577 | bool found = false; |
| 578 | for (const auto& source : _sources) { |
| 579 | Variant v; |
| 580 | if (source(infix[i].first, v)) { |
| 581 | found = true; |
| 582 | break; |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | if (found) { |
| 587 | ++i; |
| 588 | return true; |
| 589 | } else if (infix[i].second != Lexer::Type::op) { |
| 590 | ++i; |
| 591 | return true; |
| 592 | } |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | return false; |
| 597 | } |
| 598 | |
| 599 | //////////////////////////////////////////////////////////////////////////////// |
| 600 | // Dijkstra Shunting Algorithm. |
nothing calls this directly
no outgoing calls
no test coverage detected