MCPcopy
hub / github.com/google/mangle / showPredicate

Method showPredicate

interpreter/interpreter.go:123–141  ·  view source on GitHub ↗
(p ast.PredicateSym)

Source from the content-addressed store, hash-verified

121}
122
123func (i *Interpreter) showPredicate(p ast.PredicateSym) {
124 const docStringMargin = 50
125 decl := i.knownPredicates[p]
126 atomText := decl.DeclaredAtom.DisplayString()
127 if docLines := decl.Doc(); len(docLines) != 0 && docLines[0] != "" {
128 prefixLen := 0
129 if len(atomText) < docStringMargin {
130 prefixLen = len(atomText)
131 }
132 spacer := strings.Repeat(" ", docStringMargin-prefixLen)
133 if len(atomText) < docStringMargin {
134 fmt.Fprintf(i.out, "%s%s%s\n", atomText, spacer, docLines[0])
135 } else {
136 fmt.Fprintf(i.out, "%s\n%s%s\n", atomText, spacer, docLines[0])
137 }
138 } else {
139 fmt.Fprintf(i.out, "%s\n", atomText)
140 }
141}
142
143// Show shows information about predicates.
144// If arg = "all", it lists all predicate.

Callers 1

ShowMethod · 0.95

Calls 2

DocMethod · 0.80
DisplayStringMethod · 0.45

Tested by

no test coverage detected