| 452 | int NumExpectedParameters() const override { return 3; } |
| 453 | |
| 454 | std::string Evaluate( |
| 455 | std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval, |
| 456 | GeneratorExpressionContent const* content, |
| 457 | cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override |
| 458 | { |
| 459 | if (parameters.size() != 3) { |
| 460 | reportError(eval, content->GetOriginalExpression(), |
| 461 | "$<FILTER:...> expression requires three parameters"); |
| 462 | return {}; |
| 463 | } |
| 464 | |
| 465 | if (parameters[1] != "INCLUDE" && parameters[1] != "EXCLUDE") { |
| 466 | reportError( |
| 467 | eval, content->GetOriginalExpression(), |
| 468 | "$<FILTER:...> second parameter must be either INCLUDE or EXCLUDE"); |
| 469 | return {}; |
| 470 | } |
| 471 | |
| 472 | try { |
| 473 | return cmList{ parameters.front(), cmList::EmptyElements::Yes } |
| 474 | .filter(parameters[2], |
| 475 | parameters[1] == "EXCLUDE" ? cmList::FilterMode::EXCLUDE |
| 476 | : cmList::FilterMode::INCLUDE) |
| 477 | .to_string(); |
| 478 | } catch (std::invalid_argument&) { |
| 479 | reportError(eval, content->GetOriginalExpression(), |
| 480 | "$<FILTER:...> failed to compile regex"); |
| 481 | return {}; |
| 482 | } |
| 483 | } |
| 484 | } filterNode; |
| 485 | |
| 486 | static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode |
nothing calls this directly
no test coverage detected