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

Method VisitCalc

parser/parser.go:529–541  ·  view source on GitHub ↗

Visit a parse tree produced by CELParser#calc.

(ctx *gen.CalcContext)

Source from the content-addressed store, hash-verified

527
528// Visit a parse tree produced by CELParser#calc.
529func (p *parser) VisitCalc(ctx *gen.CalcContext) any {
530 opText := ""
531 if ctx.GetOp() != nil {
532 opText = ctx.GetOp().GetText()
533 }
534 if op, found := operators.Find(opText); found {
535 lhs := p.Visit(ctx.Calc(0)).(ast.Expr)
536 opID := p.helper.id(ctx.GetOp())
537 rhs := p.Visit(ctx.Calc(1)).(ast.Expr)
538 return p.globalCallOrMacro(opID, op, lhs, rhs)
539 }
540 return p.reportError(ctx, "operator not found")
541}
542
543func (p *parser) VisitUnary(ctx *gen.UnaryContext) any {
544 return p.helper.newLiteralString(ctx, "<<error>>")

Callers 1

VisitMethod · 0.95

Calls 8

VisitMethod · 0.95
globalCallOrMacroMethod · 0.95
reportErrorMethod · 0.95
FindFunction · 0.92
GetTextMethod · 0.80
idMethod · 0.80
GetOpMethod · 0.65
CalcMethod · 0.65

Tested by

no test coverage detected