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

Method VisitInt

parser/antlr_parser.go:677–692  ·  view source on GitHub ↗

Visit a parse tree produced by CELParser#Int.

(ctx *gen.IntContext)

Source from the content-addressed store, hash-verified

675
676// Visit a parse tree produced by CELParser#Int.
677func (p *antlrVisitor) VisitInt(ctx *gen.IntContext) any {
678 text := ctx.GetTok().GetText()
679 base := 10
680 if strings.HasPrefix(text, "0x") {
681 base = 16
682 text = text[2:]
683 }
684 if ctx.GetSign() != nil {
685 text = ctx.GetSign().GetText() + text
686 }
687 i, err := strconv.ParseInt(text, base, 64)
688 if err != nil {
689 return p.reportError(ctx, "invalid int literal")
690 }
691 return p.helper.newLiteralInt(ctx, i)
692}
693
694// Visit a parse tree produced by CELParser#Uint.
695func (p *antlrVisitor) VisitUint(ctx *gen.UintContext) any {

Callers 1

VisitMethod · 0.95

Calls 5

reportErrorMethod · 0.95
GetTextMethod · 0.80
newLiteralIntMethod · 0.80
GetTokMethod · 0.45
GetSignMethod · 0.45

Tested by

no test coverage detected