Integrated code formatter

user1234 user1234 at 12.de
Tue Jan 18 17:09:46 UTC 2022


On Tuesday, 18 January 2022 at 12:51:33 UTC, deadalnix wrote:
> On Tuesday, 18 January 2022 at 08:36:18 UTC, user1234 wrote:
>> On Tuesday, 18 January 2022 at 03:30:53 UTC, Walter Bright 
>> wrote:
>>> On 1/17/2022 6:06 PM, deadalnix wrote:
>>>> Modern formatter, such as clang-format, use a parser, but 
>>>> the parser generates an IR that as nothing to do with the 
>>>> traditional AST you'd get out of a regular parser.
>>>
>>> What comes to mind is what to do with the comments.
>>
>> They must be kept, which is what dfmt does as it follows the 
>> token stream and *not* the AST.
>
> See 
> https://forum.dlang.org/post/givmbzmvnjnweozrexgm@forum.dlang.org

yeah dfmt does works like I say 
https://github.com/dlang-community/dfmt/blob/master/src/dfmt/formatter.d.


More information about the Digitalmars-d mailing list