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

Function ErrorRecoveryLookaheadTokenLimit

parser/options.go:54–62  ·  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

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

Callers 5

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