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

Function ErrorRecoveryLookaheadTokenLimit

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

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