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

Method VisitSelect

parser/parser.go:575–596  ·  view source on GitHub ↗

VisitSelect visits a parse tree produced by CELParser#Select.

(ctx *gen.SelectContext)

Source from the content-addressed store, hash-verified

573
574// VisitSelect visits a parse tree produced by CELParser#Select.
575func (p *parser) VisitSelect(ctx *gen.SelectContext) any {
576 operand := p.Visit(ctx.Member()).(ast.Expr)
577 // Handle the error case where no valid identifier is specified.
578 if ctx.GetId() == nil || ctx.GetOp() == nil {
579 return p.helper.newExpr(ctx)
580 }
581 id, err := p.normalizeIdent(ctx.GetId())
582 if err != nil {
583 p.reportError(ctx.GetId(), "%v", err)
584 }
585 if ctx.GetOpt() != nil {
586 if !p.enableOptionalSyntax {
587 return p.reportError(ctx.GetOp(), "unsupported syntax '.?'")
588 }
589 return p.helper.newGlobalCall(
590 ctx.GetOp(),
591 operators.OptSelect,
592 operand,
593 p.helper.newLiteralString(ctx.GetId(), id))
594 }
595 return p.helper.newSelect(ctx.GetOp(), operand, id)
596}
597
598// VisitMemberCall visits a parse tree produced by CELParser#MemberCall.
599func (p *parser) VisitMemberCall(ctx *gen.MemberCallContext) any {

Callers 1

VisitMethod · 0.95

Calls 11

VisitMethod · 0.95
normalizeIdentMethod · 0.95
reportErrorMethod · 0.95
newGlobalCallMethod · 0.80
newLiteralStringMethod · 0.80
newSelectMethod · 0.80
GetIdMethod · 0.65
GetOpMethod · 0.65
GetOptMethod · 0.65
MemberMethod · 0.45
newExprMethod · 0.45

Tested by

no test coverage detected