VisitLetStmt visits a parse tree produced by MangleParser#letStmt.
(ctx *gen.LetStmtContext)
| 384 | |
| 385 | // VisitLetStmt visits a parse tree produced by MangleParser#letStmt. |
| 386 | func (p Parser) VisitLetStmt(ctx *gen.LetStmtContext) any { |
| 387 | v := ast.Variable{ctx.VARIABLE().GetText()} |
| 388 | rhs := p.Visit(ctx.Term()).(ast.Term) |
| 389 | apply, ok := rhs.(ast.ApplyFn) |
| 390 | if !ok { |
| 391 | p.errors.Add(fmt.Sprintf("expected fn application got %v", rhs), ctx.Term().GetStart().GetLine(), ctx.Term().GetStart().GetColumn()) |
| 392 | return ast.TransformStmt{&v, ast.ApplyFn{ast.FunctionSym{"fn:b0rk", 0}, nil}} |
| 393 | } |
| 394 | return ast.TransformStmt{&v, apply} |
| 395 | } |
| 396 | |
| 397 | // VisitLiteralOrFml visits a parse tree produced by literalOrFml |
| 398 | func (p Parser) VisitLiteralOrFml(ctx *gen.LiteralOrFmlContext) any { |