Skip to content

Commit 0d99a67

Browse files
authored
Bugfix: call node print function instead of built-in print function (#188)
When printing the AST to a string using the SprintSyntaxTree function, I was seeing pointer addresses being printed to stdout. Upon looking at the code, I found that in the `printFunc` function that writes the AST to a `io.Writer`, the recursive call is incorrectly calling the built-in `print` function instead of `printFunc`.
1 parent db23d0f commit 0d99a67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tree/peg.go.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (n *node[U]) print(w io.Writer, pretty bool, buffer string) {
6262
fmt.Fprintf(w, "\x1B[36m%v\x1B[m %v\n", rule, quote)
6363
}
6464
if n.up != nil {
65-
print(n.up, depth+1)
65+
printFunc(n.up, depth+1)
6666
}
6767
n = n.next
6868
}

0 commit comments

Comments
 (0)