<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Someone really should fix the bugs in erl_prettypr.</div><div><br></div><div>BR,</div><div>Ulf W<br><br>Ulf Wiger, Feuerlabs, Inc.<div><a href="http://www.feuerlabs.com">http://www.feuerlabs.com</a></div></div><div><br>25 sep 2012 kl. 22:31 skrev Roberto Ostinelli <<a href="mailto:roberto@widetag.com">roberto@widetag.com</a>>:<br><br></div><blockquote type="cite"><div>Thank you Ulf,<div><br></div><div>I've looked at this and it reads from .beam files. Same problem as before: as specified I need to parse string() code.</div><div><br></div><div>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?</div>
<div><br></div><div><br><br><div class="gmail_quote">On Tue, Sep 25, 2012 at 1:34 AM, Ulf Wiger <span dir="ltr"><<a href="mailto:ulf@feuerlabs.com" target="_blank">ulf@feuerlabs.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>Roberto,</div><div><br></div><div>It appears as if erl_pp:form/1 does a much better job of formatting specs,</div><div>but then, of course, you lose the comments.</div>
<div><br></div><div>There is also an issue with typed record fields, which seems to affect </div><div>erl_prettypr as well. It simply removes the types from record declarations.</div><div><br></div><div>Take a look at parse_trans_pp:beam/1. It makes no effort to preserve comments</div>
<div>(naturally, since it doesn't expect to find any), but handles specs and typed </div><div>records correctly.</div><div><br></div><div><a href="https://github.com/uwiger/parse_trans/blob/master/src/parse_trans_pp.erl#L71" target="_blank">https://github.com/uwiger/parse_trans/blob/master/src/parse_trans_pp.erl#L71</a></div>
<div><br></div><div>This module, BTW, is also made to be used as an escript, and I have the </div><div>following convenient alias:</div><div><br></div><div><div>alias pp='escript /Users/uwiger/git/parse_trans/ebin/parse_trans_pp.beam'</div>
</div><div><br></div><div>Not that the last point was particularly relevant to your particular problem. :)</div><div><br></div><div>BR,</div><div>Ulf W</div></div></blockquote></div><br></div>
</div></blockquote></body></html>