MCPcopy Create free account
hub / github.com/akyoto/q / write

Method write

src/expression/write.go:10–35  ·  view source on GitHub ↗

write generates a textual representation of the expression.

(builder *strings.Builder, source []byte)

Source from the content-addressed store, hash-verified

8func (expr *Expression) write(builder *strings.Builder, source []byte) {
9 if expr.IsLeaf() {
10 builder.WriteString(expr.Token.StringFrom(source))
11 return
12 }
13
14 builder.WriteByte('(')
15 builder.WriteString(expr.Token.Kind.String())
16
17 for _, child := range expr.Children {
18 builder.WriteByte(' ')
19 child.write(builder, source)
20 }
21
22 builder.WriteByte(')')
23}

Callers 1

StringMethod · 0.95

Calls 3

IsLeafMethod · 0.95
StringFromMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected