Add `printer/dom` package for AST pretty printer
This adds a package for formatting and rendering text. It provides a DOM-like tree structure, Dom, which is a tree of Chunks. A Chunk represents a line of text with configurations around indentation and whitespace.
When formatting the Dom, the caller will provide a line limit and an indent string, e.g. " " for a 2-space indent. Indentation controls the leading whitespace of a Chunk, and it is based on the indent string set, indent depth of the Chunk, and the splitting pattern at render time. Splitting controls the trailing whitespace for a Chunk. A SoftSplit means that based on the line length set on the formatting, the Chunk may have a newline (hard split) or double newline following its text. However, if the Chunk remains unsplit at render time, then a trailing space will be added based on spaceifUnsplit.
TODOs:
- [ ] Fix
bracesparser indom_test.go - [ ] Consider whether we need a
Zeroconcept forChunkandChunks - [ ] Some in-line questions/comments