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

Function ErrorRecoveryLookaheadTokenLimit

parser/options.go:57–65  ·  view source on GitHub ↗

ErrorRecoveryLookaheadTokenLimit limits the number of lexer tokens that may be considered during error recovery. Error recovery often involves looking ahead in the input to determine if there's a point at which parsing may successfully resume. In some pathological cases, the parser can look through

(limit int)

Source from the content-addressed store, hash-verified

55//
56// The limit must be >= 1, and is recommended to be less than the default of 256.
57func ErrorRecoveryLookaheadTokenLimit(limit int) Option {
58 return func(opts *options) error {
59 if limit < 1 {
60 return fmt.Errorf("error recovery lookahead token limit must be at least 1: %d", limit)
61 }
62 opts.errorRecoveryTokenLookaheadLimit = limit
63 return nil
64 }
65}
66
67// ErrorRecoveryLimit limits the number of attempts the parser will perform to recover from an error.
68func ErrorRecoveryLimit(limit int) Option {

Callers 6

parser_test.goFile · 0.85
TestParserOptionErrorsFunction · 0.85
BenchmarkParseFunction · 0.85
BenchmarkParseParallelFunction · 0.85
newTestParserFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestParserOptionErrorsFunction · 0.68
BenchmarkParseFunction · 0.68
BenchmarkParseParallelFunction · 0.68
newTestParserFunction · 0.68