MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Exec

Method Exec

interpreter/decorators.go:222–243  ·  view source on GitHub ↗
(frame *ExecutionFrame)

Source from the content-addressed store, hash-verified

220}
221
222func (r *regexLimitCall) Exec(frame *ExecutionFrame) ref.Val {
223 args := r.Args()
224 if len(args) >= 2 {
225 patternVal := args[1].Exec(frame)
226 if types.IsError(patternVal) {
227 return patternVal
228 }
229 if types.IsUnknown(patternVal) {
230 return patternVal
231 }
232 if pat, ok := patternVal.(types.String); ok {
233 sz, err := types.RegexProgramSize(string(pat))
234 if err != nil {
235 return types.WrapErr(err)
236 }
237 if sz > r.limit {
238 return types.WrapErr(fmt.Errorf("regex program size %d exceeds limit of %d", sz, r.limit))
239 }
240 }
241 }
242 return r.InterpretableCall.Exec(frame)
243}
244
245func maybeOptimizeConstUnary(i InterpretableV2, call InterpretableCall) (InterpretableV2, error) {
246 args := call.Args()

Callers

nothing calls this directly

Calls 6

IsErrorFunction · 0.92
IsUnknownFunction · 0.92
RegexProgramSizeFunction · 0.92
WrapErrFunction · 0.92
ArgsMethod · 0.65
ExecMethod · 0.65

Tested by

no test coverage detected