Is anyone working on a D source code formatting tool?

Brian Schott via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 16 07:55:52 PST 2015


On Friday, 16 January 2015 at 15:06:42 UTC, Ary Borenszweig wrote:
> The way I did it in Descent (I copied the logic from JDT) is to 
> parse the code into an AST, and then walk the AST in sync with 
> a lexer.

My dfmt tool does something similar. The parser runs over the 
code first and makes notes on things like the location of unary 
operators and which braces end function/aggregate declarations. 
Then the formatter iterates over the tokens (including comments) 
and is able to correctly print "a* b;" instead of "a * b;".


More information about the Digitalmars-d mailing list