Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cel/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,8 @@ func ParserRecursionLimit(limit int) EnvOption {
return setLimit(limitParseRecursionDepth, limit)
}

// ParserRecursionLimit adjusts the AST depth the parser will tolerate.
// Defaults defined in the parser package.
// ParserErrorRecoveryLimit sets the number of attemtps the parser will take
// to recover after encountering an error.
func ParserErrorRecoveryLimit(limit int) EnvOption {
return setLimit(limitParseErrorRecovery, limit)
}
Expand Down
4 changes: 4 additions & 0 deletions common/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,15 +746,19 @@ func (feat *Feature) Validate() error {
return nil
}

// Limit represents a named limit in the CEL environment. This is used to control
// the complexity tolerated before failing parsing, type checking, or planning.
type Limit struct {
Name string `yaml:"name"`
Value int `yaml:"value"`
}

// NewLimit creates a new limit.
func NewLimit(name string, value int) *Limit {
return &Limit{name, value}
}

// Validate validates a limit.
func (l *Limit) Validate() error {
if l == nil {
return errors.New("invalid limit: nil")
Expand Down