On Tuesday, 3 March 2015 at 20:36:20 UTC, Walter Bright wrote:
Thanks for doing this. It's an important part of the D
toolchain we need to have. At some point I want to merge it
into the official release.
I noticed it is remarkably small (1400 lines). What is its
algorithm? How does it compare with gofmt and clang-format in
how it works?
I haven't read the source to either of those programs, so I'm not
sure how it compares.
dfmt works by re-using my existing lexer and parser. The parser
is run on the code first so that the formatting step knows a few
things like the difference between the binary and unary forms of
"*". Line splitting is figured out using a badly mangled version