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

Method checkRecursion

parser/pratt_parser.go:175–185  ·  view source on GitHub ↗

checkRecursion returns true and trips the recursion limit if depth exceeds the configured limit. The parser bounds two depths separately against maxRecursionDepth: - recursionDepth tracks syntactic expression nesting: each parenthesized expression, list, map or struct element, call argument, index

(depth int)

Source from the content-addressed store, hash-verified

173// by recursionDepth) do not add to it. Because operator and selector chains are parsed
174// iteratively, this depth is computed bottom-up and checked as each node is built.
175func (p *prattParserWorker) checkRecursion(depth int) bool {
176 if depth > p.maxRecursionDepth {
177 if !p.recursionLimitExceeded {
178 p.recursionLimitExceeded = true
179 p.errors.internalError(fmt.Sprintf("expression recursion limit exceeded: %d", p.maxRecursionDepth))
180 p.peekTok = token{kind: tokEnd, start: p.length, end: p.length}
181 }
182 return true
183 }
184 return false
185}
186
187func (p *prattParserWorker) nextSignificantToken() token {
188 if p.isRecoveryLimitExceeded() {

Callers 5

parseExprMethod · 0.95
parseTernaryMethod · 0.95
parsePrimaryMethod · 0.95

Calls 1

internalErrorMethod · 0.80

Tested by

no test coverage detected