VisitClause visits a parse tree produced by MangleParser#clause.
(ctx *gen.ClauseContext)
| 325 | |
| 326 | // VisitClause visits a parse tree produced by MangleParser#clause. |
| 327 | func (p Parser) VisitClause(ctx *gen.ClauseContext) any { |
| 328 | head := p.Visit(ctx.Atom()).(ast.Atom) |
| 329 | |
| 330 | // Check for temporal annotation on head |
| 331 | var headTime *ast.Interval |
| 332 | if tempAnnot := ctx.TemporalAnnotation(); tempAnnot != nil { |
| 333 | headTime = p.Visit(tempAnnot).(*ast.Interval) |
| 334 | } |
| 335 | |
| 336 | if (ctx.COLONDASH() != nil) || (ctx.LONGLEFTDOUBLEARROW() != nil) { |
| 337 | body := p.Visit(ctx.ClauseBody()).(ast.Clause) |
| 338 | body.Head = head |
| 339 | body.HeadTime = headTime |
| 340 | return body |
| 341 | } |
| 342 | return ast.NewTemporalClause(head, headTime, nil) |
| 343 | } |
| 344 | |
| 345 | // VisitClauseBody visits a parse tree produced by MangleParser#clauseBody. |
| 346 | func (p Parser) VisitClauseBody(ctx *gen.ClauseBodyContext) any { |
no test coverage detected