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