> comments in particular are tricky and might get moved to slightly unexpected > places
FWIW I found it so "tricky" that I abandoned the "render AST" idea altogether and went with "render tokens instead". I have never regretted this decision. However, `nimpretty` does get semantic feedback from the parser, so there are no inherent limitations to this approach. What nimpretty can steal from your work is the final step "ask parser again about the resulting AST", ensuring it didn't mess it up. That's a great idea and easy to implement. :-)