Visit a parse tree produced by CELParser#Int.
(ctx *gen.IntContext)
| 761 | |
| 762 | // Visit a parse tree produced by CELParser#Int. |
| 763 | func (p *parser) VisitInt(ctx *gen.IntContext) any { |
| 764 | text := ctx.GetTok().GetText() |
| 765 | base := 10 |
| 766 | if strings.HasPrefix(text, "0x") { |
| 767 | base = 16 |
| 768 | text = text[2:] |
| 769 | } |
| 770 | if ctx.GetSign() != nil { |
| 771 | text = ctx.GetSign().GetText() + text |
| 772 | } |
| 773 | i, err := strconv.ParseInt(text, base, 64) |
| 774 | if err != nil { |
| 775 | return p.reportError(ctx, "invalid int literal") |
| 776 | } |
| 777 | return p.helper.newLiteralInt(ctx, i) |
| 778 | } |
| 779 | |
| 780 | // Visit a parse tree produced by CELParser#Uint. |
| 781 | func (p *parser) VisitUint(ctx *gen.UintContext) any { |
no test coverage detected