| 71 | } // namespace |
| 72 | |
| 73 | Validation RegexPatternValidator( |
| 74 | absl::string_view id, std::vector<RegexPatternValidatorConfig> config) { |
| 75 | return Validation( |
| 76 | [config = std::move(config)](ValidationContext& context) -> bool { |
| 77 | bool result = true; |
| 78 | for (const auto& node : |
| 79 | context.navigable_ast().Root().DescendantsPostorder()) { |
| 80 | if (node.node_kind() == NodeKind::kCall) { |
| 81 | for (const auto& config : config) { |
| 82 | if (node.expr()->call_expr().function() == config.function_name) { |
| 83 | if (!CheckPattern(context, node, config.pattern_arg_index)) { |
| 84 | result = false; |
| 85 | } |
| 86 | break; |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | return result; |
| 92 | }, |
| 93 | id); |
| 94 | } |
| 95 | |
| 96 | } // namespace cel |
no test coverage detected