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

Method reportError

parser/pratt_parser.go:308–330  ·  view source on GitHub ↗
(ctx any, format string, args ...any)

Source from the content-addressed store, hash-verified

306}
307
308func (p *prattParserWorker) reportError(ctx any, format string, args ...any) ast.Expr {
309 if p.isRecoveryLimitExceeded() {
310 return p.helper.newExpr(common.NoLocation)
311 }
312 p.errorCount++
313 var location common.Location
314 err := p.helper.newExpr(ctx)
315 switch c := ctx.(type) {
316 case common.Location:
317 location = c
318 case token:
319 location = p.helper.getLocation(err.ID())
320 default:
321 location = p.helper.getLocation(err.ID())
322 }
323 if p.errorCount <= p.errorReportingLimit {
324 p.errors.reportErrorAtID(err.ID(), location, format, args...)
325 }
326 if p.isRecoveryLimitExceeded() {
327 p.peekTok = token{kind: tokEnd, start: p.length, end: p.length}
328 }
329 return err
330}
331
332func (p *prattParserWorker) reportSyntaxError(ctx any, format string, args ...any) ast.Expr {
333 return p.reportError(ctx, "Syntax error: "+format, args...)

Callers 10

reportSyntaxErrorMethod · 0.95
expandMacroMethod · 0.95
normalizeIdentMethod · 0.95
parseStructMethod · 0.95
parseListMethod · 0.95
parseMapMethod · 0.95
parseIdentOrCallMethod · 0.95
parseStringLiteralMethod · 0.95
parseBytesLiteralMethod · 0.95

Calls 5

getLocationMethod · 0.80
reportErrorAtIDMethod · 0.80
IDMethod · 0.65
newExprMethod · 0.45

Tested by

no test coverage detected