From 8324b83e399ec8bff54e06565390fc0b9ab43967 Mon Sep 17 00:00:00 2001 From: Khilan Gudka <1684714+khilangudka@users.noreply.github.com> Date: Mon, 20 Oct 2025 14:51:36 +0100 Subject: [PATCH] Bugfix: call node print function instead of built-in print function 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`. --- tree/peg.go.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tree/peg.go.tmpl b/tree/peg.go.tmpl index 6198964..0c7a275 100644 --- a/tree/peg.go.tmpl +++ b/tree/peg.go.tmpl @@ -62,7 +62,7 @@ func (n *node[U]) print(w io.Writer, pretty bool, buffer string) { fmt.Fprintf(w, "\x1B[36m%v\x1B[m %v\n", rule, quote) } if n.up != nil { - print(n.up, depth+1) + printFunc(n.up, depth+1) } n = n.next }