MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / RegexPatternValidator

Function RegexPatternValidator

validator/regex_validator.cc:73–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71} // namespace
72
73Validation 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

Callers 2

MatchesValidatorFunction · 0.85
RegexExtValidatorFunction · 0.85

Calls 5

ValidationClass · 0.85
CheckPatternFunction · 0.85
DescendantsPostorderMethod · 0.80
node_kindMethod · 0.80
exprMethod · 0.45

Tested by

no test coverage detected