Print out the view in an indented, XML-like tree form
| 30 | |
| 31 | @dc.dataclass |
| 32 | class PrettyPrinter(ViewVisitor): |
| 33 | """Print out the view in an indented, XML-like tree form""" |
| 34 | |
| 35 | indent: int = 1 |
| 36 | |
| 37 | @multimethod |
| 38 | def visit(self, b: BaseBlock): |
| 39 | print("|", "-" * self.indent, str(b), sep="") |
| 40 | |
| 41 | @multimethod |
| 42 | def visit(self, b: ContainerBlock): |
| 43 | print("|", "-" * self.indent, str(b), sep="") |
| 44 | self.indent += 2 |
| 45 | _ = b.traverse(self) |
| 46 | self.indent -= 2 |
| 47 | |
| 48 | |
| 49 | # TODO - split out into BlockBuilder helper here |