MCPcopy Index your code
hub / github.com/google/mangle / VisitClause

Method VisitClause

parse/parse.go:327–343  ·  view source on GitHub ↗

VisitClause visits a parse tree produced by MangleParser#clause.

(ctx *gen.ClauseContext)

Source from the content-addressed store, hash-verified

325
326// VisitClause visits a parse tree produced by MangleParser#clause.
327func (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.
346func (p Parser) VisitClauseBody(ctx *gen.ClauseBodyContext) any {

Callers 1

VisitMethod · 0.95

Calls 7

VisitMethod · 0.95
NewTemporalClauseFunction · 0.92
AtomMethod · 0.65
TemporalAnnotationMethod · 0.65
COLONDASHMethod · 0.65
LONGLEFTDOUBLEARROWMethod · 0.65
ClauseBodyMethod · 0.65

Tested by

no test coverage detected