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

Method VisitUint

parser/parser.go:781–795  ·  view source on GitHub ↗

Visit a parse tree produced by CELParser#Uint.

(ctx *gen.UintContext)

Source from the content-addressed store, hash-verified

779
780// Visit a parse tree produced by CELParser#Uint.
781func (p *parser) VisitUint(ctx *gen.UintContext) any {
782 text := ctx.GetTok().GetText()
783 // trim the 'u' designator included in the uint literal.
784 text = text[:len(text)-1]
785 base := 10
786 if strings.HasPrefix(text, "0x") {
787 base = 16
788 text = text[2:]
789 }
790 i, err := strconv.ParseUint(text, base, 64)
791 if err != nil {
792 return p.reportError(ctx, "invalid uint literal")
793 }
794 return p.helper.newLiteralUint(ctx, i)
795}
796
797// Visit a parse tree produced by CELParser#Double.
798func (p *parser) VisitDouble(ctx *gen.DoubleContext) any {

Callers 1

VisitMethod · 0.95

Calls 4

reportErrorMethod · 0.95
GetTextMethod · 0.80
newLiteralUintMethod · 0.80
GetTokMethod · 0.45

Tested by

no test coverage detected