<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>You could take a look at how parse_trans does it:</div><div><br></div><div><a href="https://github.com/esl/parse_trans/blob/master/src/parse_trans_pp.erl#L65">https://github.com/esl/parse_trans/blob/master/src/parse_trans_pp.erl#L65</a></div><div><br></div><div>It uses erl_pp instead of erl_prettypr for reasons I have since forgotten</div><div>(it was something that, at one time, erl_prettypr had problems with, but</div><div>erl_pp was able to handle).</div><div><br></div><div>BR,</div><div>Ulf W</div><br><div><div>On 11 May 2012, at 22:01, Roberto Ostinelli wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Dear All,<div><br></div><div>is there a way to use prettypr on a list()?</div><div><br></div><div>I want to pretty format some source code, all I found is a Trapexit post showing this:</div><div><br></div><div><span style="font-family:'Trebuchet MS','Lucida Grande',Verdana,Arial,sans-serif;font-size:13px;line-height:16px;text-align:left;background-color:rgb(243,243,243)">F="tst.erl",</span></div>
<div><span style="font-family:'Trebuchet MS','Lucida Grande',Verdana,Arial,sans-serif;font-size:13px;line-height:16px;text-align:left;background-color:rgb(243,243,243)">erl_prettypr:format(erl_recomment:recomment_forms(element(2,epp_dodger:parse_file(F)),erl_comment_scan:file(F))).</span><br style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-family:'Trebuchet MS','Lucida Grande',Verdana,Arial,sans-serif;font-size:13px;line-height:16px;text-align:left;background-color:rgb(243,243,243)">
</div><div style="text-align:left"><font face="'Trebuchet MS', 'Lucida Grande', Verdana, Arial, sans-serif"><span style="line-height:16px"><br></span></font></div><div style="text-align:left"><span style="text-align:-webkit-auto">Unfortunately this is based on parsing a file, and epp_dodger needs an IoDevice to parse code.</span></div>
<div style="text-align:left"><span style="text-align:-webkit-auto"><br></span></div><div style="text-align:left"><span style="text-align:-webkit-auto">Is there a way to do something similar but inputting the code as list() instead of parsing a file?</span></div>
<div style="text-align:left"><span style="text-align:-webkit-auto"><br></span></div><div style="text-align:left"><span style="text-align:-webkit-auto">r.</span></div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br><div apple-content-edited="true">
<div><div>Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.</div><div><a href="http://feuerlabs.com">http://feuerlabs.com</a></div></div><div><br></div><br class="Apple-interchange-newline">
</div>
<br></body></html>