2 ms·
> I am also working on a whitespace and comment preserving parser that round-trips, so you can change a value in a configuration file without loosing comments.
by nly 9y ago
> I am also working on a whitespace and comment preserving parser that round-trips, so you can change a value in a configuration file without loosing comments.
I am 80% done writing such a parser for a over-engineered legacy config file format. It isn't that hard really, you just need a parser framework/library that can output a complete parse tree (a tree where a preorder traversal covers every byte in the input contiguously, exactly once).
The remaining 20% of the work is keeping track of the line and column number (almost there), cleaning up the code, and being able to reserialize the AST to a binary format (for reloading in another process where I don't want to have to rerun the original PEG)