Tree.show: def of bolt@1.27.0.0 Import: import bolt@1.27.0.0/src/syntax/tree.bend as Tree Lines 445-461 of bolt@1.27.0.0/src/syntax/tree.bend: https://jend.leeeet.dev/read.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&start_line=445&end_line=461 import Base import bolt@1.27.0.0/src/syntax/lex.bend as Lex # `[def f (x : U32) -> U32 : {[match x {[case A {} : {[1]}]}]}]`: a statement # in brackets, its body in braces, a group as its brackets (an unclosed one # ends in `..`) def show(nn: Node) -> String: match nn: case Leaf{Lex.Tok{k, t, l, c}}: t case Group{Lex.Tok{k, t, l, c}, kids, close}: t ++ show(kids) ++ show_close(close) case Stmt{kind, kids, body}: +b = show(body) "[" ++ show(kids) ++ Bool.pick(String, String.is_empty(b), "", " {" ++ b ++ "}") ++ "]" case NNil{}: "" case NCons{h, t}: +rest = show(t) show(h) ++ Bool.pick(String, String.is_empty(rest), "", " " ++ rest) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.is_empty https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=Tok https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=Node https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=show_close