[erlang-questions] prettypr and spec
Roberto Ostinelli
roberto@REDACTED
Tue Sep 25 22:31:00 CEST 2012
Thank you Ulf,
I've looked at this and it reads from .beam files. Same problem as before:
as specified I need to parse string() code.
Do I really have to write my own erlang indenter? That really seems weird.
Isn't there such a thing like a DSL for indenters?
On Tue, Sep 25, 2012 at 1:34 AM, Ulf Wiger <ulf@REDACTED> wrote:
>
> Roberto,
>
> It appears as if erl_pp:form/1 does a much better job of formatting specs,
> but then, of course, you lose the comments.
>
> There is also an issue with typed record fields, which seems to affect
> erl_prettypr as well. It simply removes the types from record declarations.
>
> Take a look at parse_trans_pp:beam/1. It makes no effort to preserve
> comments
> (naturally, since it doesn't expect to find any), but handles specs and
> typed
> records correctly.
>
>
> https://github.com/uwiger/parse_trans/blob/master/src/parse_trans_pp.erl#L71
>
> This module, BTW, is also made to be used as an escript, and I have the
> following convenient alias:
>
> alias pp='escript /Users/uwiger/git/parse_trans/ebin/parse_trans_pp.beam'
>
> Not that the last point was particularly relevant to your particular
> problem. :)
>
> BR,
> Ulf W
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120925/fc0fae3b/attachment.htm>
More information about the erlang-questions
mailing list