[erlang-questions] Pretty-printing Erlang

Vlad Dumitrescu vladdu55@REDACTED
Thu Oct 21 15:43:00 CEST 2010

On Thu, Oct 21, 2010 at 15:27, Ulf Wiger <ulf.wiger@REDACTED> wrote:
> Actually, erl_scan now supports the options 'return_whitespace' and
> 'return_comments', so it should at least be possible to preserve
> formatting and comments in future tools.

Yes, the scanner is now almost good enough for this purpose (I believe
that instead of column information it should use offset from the start
of the buffer, because it makes tools further up the chain simpler) .

The next step is to adapt the parser. More precisely, I think that a
separate parser is a better idea, because the requirements between
parsing-before-compiling and parsing-before-processing-source are
different. In the latter case, besides the points I mentioned before,
one has to have a better error handling too, so that one can even
handle incomplete or malformed code (something like the preprocessor
does with "weird" macros, treating them as text, but at a higher

best regards,

More information about the erlang-questions mailing list