Integrated code formatter
deadalnix
deadalnix at gmail.com
Tue Jan 18 12:48:03 UTC 2022
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.
Yes, this is the most obvious ones, but then you have, what to do
with whitespaces? There is a ton of semantic conveyed in
whitespace, for instance, one new line or two new lines? It gets
worse when you want to add features such as "don't format that
specific chunk of code" because now you need ot be able to encode
EVERYTHING in the AST, and it gets very teddious.
More information about the Digitalmars-d
mailing list