Visit a parse tree produced by CELParser#Int.
(ctx *gen.IntContext)
| 675 | |
| 676 | // Visit a parse tree produced by CELParser#Int. |
| 677 | func (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. |
| 695 | func (p *antlrVisitor) VisitUint(ctx *gen.UintContext) any { |
no test coverage detected