<div>Thank you Ulf.</div><div><br></div><div>So i first should erl_parse:tokens/1, then erl_parse:parse/form/1 then use what you suggested?</div><br><br><div class="gmail_quote">On Fri, May 11, 2012 at 1:09 PM, 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>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" target="_blank">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><div class="h5"><div>On 11 May 2012, at 22:01, Roberto Ostinelli wrote:</div>
<br></div></div><blockquote type="cite"><div><div class="h5">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></div></div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br><div>
<div><div>Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.</div><div><a href="http://feuerlabs.com" target="_blank">http://feuerlabs.com</a></div></div><div><br></div><br>
</div>
<br></div></blockquote></div><br>