Is anyone working on a D source code formatting tool?

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 12 11:20:34 PST 2015


On Monday, 12 January 2015 at 15:30:42 UTC, qznc wrote:
>> So I started conceiving of a language in which even the 
>> *comments* were part of the AST. For, me this would be the 
>> aesthetic ideal. It just seemed like the next step in total 
>> AST integration.
>
> The clang-format approach is to make decisions based on the AST,
> but edit the byte array. AST nodes contain exact positions: line
> and column numbers. Sometimes more of them. For example, an
> if-statement needs to know the position of 'else' as well.
>
> Here is another example: void setX(int position /* inches */);
> However, I think it should really be wrapped into a struct
> instead to get type checker's approval.
>
> Initially, clang-format only did whitespace changes. I am not
> sure if they weakened this already. For example, stripping 
> parens
> in expressions (((((x)))) => x) would be acceptable for me.
>
>
> btw +1 for https://github.com/Hackerpilot/dfmt

Last time I checked, it work on the lexer rather than the AST.


More information about the Digitalmars-d mailing list