[SAOC 2023] dfmt rewrite - Weekly update #3

max haughton maxhaton at gmail.com
Fri Oct 6 16:21:29 UTC 2023


On Friday, 6 October 2023 at 16:20:07 UTC, Prajwal S N wrote:
> Hi all,
>
>
> I had mentioned in my previous update that I was looking into a 
> purely lexer-based formatting implementation. I realised this 
> wouldn't work due to poor error handling, lack of semantic 
> information, and poor future-proofing in case we want to add 
> context-sensitive format rules going forward. For these 
> reasons, it would be ideal to use an AST instead.
>
> Across the last week, I've been working on getting an existing 
> pass to use the DMD AST (specifically, the pass to format 
> comments). Currently, dfmt traverses the entire tree and stores 
> the locations of each type of token, and later operates on the 
> token stream. I'm trying to see if there's a way to directly 
> operate on the AST without having to store the location 
> information.

Are you trying to write your own formatter inspired by dfmt or 
rewrite dfmt to use dmd's code?


More information about the Digitalmars-d mailing list