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

Method VisitSelect

parser/parser.go:567–588  ·  view source on GitHub ↗

VisitSelect visits a parse tree produced by CELParser#Select.

(ctx *gen.SelectContext)

Source from the content-addressed store, hash-verified

565
566// VisitSelect visits a parse tree produced by CELParser#Select.
567func (p *parser) VisitSelect(ctx *gen.SelectContext) any {
568 operand := p.Visit(ctx.Member()).(ast.Expr)
569 // Handle the error case where no valid identifier is specified.
570 if ctx.GetId() == nil || ctx.GetOp() == nil {
571 return p.helper.newExpr(ctx)
572 }
573 id, err := p.normalizeIdent(ctx.GetId())
574 if err != nil {
575 p.reportError(ctx.GetId(), "%v", err)
576 }
577 if ctx.GetOpt() != nil {
578 if !p.enableOptionalSyntax {
579 return p.reportError(ctx.GetOp(), "unsupported syntax '.?'")
580 }
581 return p.helper.newGlobalCall(
582 ctx.GetOp(),
583 operators.OptSelect,
584 operand,
585 p.helper.newLiteralString(ctx.GetId(), id))
586 }
587 return p.helper.newSelect(ctx.GetOp(), operand, id)
588}
589
590// VisitMemberCall visits a parse tree produced by CELParser#MemberCall.
591func (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