News for hackers. Stuff that matters.
Re:From AST to Lossless Syntax Tree by edsrzf on Sunday February 12, 2017 @03:18PM (#13630480)
The Go library's standard AST package[1] similarly stores comments and whitespace information. It has to, since it's used by gofmt, and you wouldn't be very happy you lost comments when formatting your code.

[1] https://golang.org/pkg/go/ast/

Re:From AST to Lossless Syntax Tree by nemo1618 on Sunday February 12, 2017 @04:30PM (#13631002)
Unfortunately, most people agree that the ast package is a mess. It isn't used by the actual compiler. There is some talk of eventually deprecating it and publishing the internal ast/parser/type-checker packages.
Re:From AST to Lossless Syntax Tree by edsrzf on Sunday February 12, 2017 @04:47PM (#13631113)
I think calling it a "mess" is hyperbole, but yes, it's true that it has shortcomings and may be deprecated and replaced.
Re:From AST to Lossless Syntax Tree by placeybordeaux on Monday February 13, 2017 @12:55AM (#13633413)
I've used it before for a tool that transforms code that throws away an error code to code that takes the error code and panics if not nil.

https://github.com/placeybordeaux/panic-attack

The package works fine, but I can't say it was fun to work with.

Re:From AST to Lossless Syntax Tree by bpicolo on Sunday February 12, 2017 @04:31PM (#13631003)
If I remember correctly rust-fmt deals with comments without them being explicitly part of the ast. Sure creates more work though