tldr : I want to format a structured textual file format (LaTeX), what is the best way to do it ?
The “what” of the story
On my way to the rustification of my own kingdom, I am trying to build a program to format LaTeX files. Not to parse them mind you (but maybe; more on that later), I am aware of some “facts”. To not reinvent the wheel I searched for past realizations that might follow that path, I found some, the most notable in my opinion use regular expressions to do its job.
The proposed solution(s)
To be a little fancier, a little voice whispered in my ears to build an AST of the files and to apply transformation to it (as Rustfmt does ?), is it a good idea ? Should I just stick to regular expressions ? What would be (if both are possible) the fastest one ?