| 96 | re2_(std::move(re2)) {} |
| 97 | |
| 98 | absl::Status Evaluate(ExecutionFrameBase& frame, Value& result, |
| 99 | AttributeTrail& attribute) const override { |
| 100 | AttributeTrail subject_attr; |
| 101 | CEL_RETURN_IF_ERROR(subject_->Evaluate(frame, result, subject_attr)); |
| 102 | if (result.IsError() || result.IsUnknown()) { |
| 103 | return absl::OkStatus(); |
| 104 | } |
| 105 | |
| 106 | if (!result.IsString()) { |
| 107 | return absl::Status(absl::StatusCode::kInternal, |
| 108 | "First argument for regular " |
| 109 | "expression match must be a string"); |
| 110 | } |
| 111 | bool match = result.GetString().NativeValue(MatchesVisitor{*re2_}); |
| 112 | result = BoolValue(match); |
| 113 | return absl::OkStatus(); |
| 114 | } |
| 115 | |
| 116 | private: |
| 117 | std::unique_ptr<DirectExpressionStep> subject_; |