Is anyone working on a D source code formatting tool?

Zach the Mystic via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 11 21:43:32 PST 2015


On Monday, 12 January 2015 at 00:38:20 UTC, Walter Bright wrote:
>>>> On 1/11/15 10:48 AM, Walter Bright wrote:
>>>>> The main problem is what to do about comments, which don't 
>>>>> fit into the
>>>>> grammar.
>>>> In the first version comments might go through unchanged.
>>>
>>> Consider:
>>>
>>>     for /*comment*/ (a;
>>>                      b;
>>>                      c)
>>>
>>> Do what with that?
>>
>> I don't know. Simplest would be to punt for now - such rare 
>> embedded comments
>> should not be blockers. -- Andrei
>
> Normally I would agree, but deleting peoples' comments from 
> their source code is not a good plan. It'll make them 
> justifiably angry.

This conversation reminds me of something I've thought about ever 
since I first studied D. D takes the C preprocessor and folds it 
into the regular AST. But comments still seemed like the outlier. 
I looked through a bunch of source code and tried to figure out 
the most specific place anyone could possibly put a comment. The 
most detailed I found were something like:

enum X {
   ONE,
   TWO, // We need a TWO here
   THREE
}

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.


More information about the Digitalmars-d mailing list