[erlang-questions] prettypr

Andrew Berman rexxe98@REDACTED
Sun May 13 22:00:13 CEST 2012


Hey Roberto,

Try epp_dodger:parse_file(Module), I think that should do it.

--Andrew

On Sun, May 13, 2012 at 11:03 AM, Roberto Ostinelli <roberto@REDACTED>wrote:

> On Fri, May 11, 2012 at 6:33 PM, Andrew Berman <rexxe98@REDACTED> wrote:
>
>> What about this?
>>
>> Comments = erl_comment_scan:string(Text),
>> {ok, Form, _} = erl_scan:string(Text),
>> {ok, Tree} = erl_parse:parse_form(Form),
>> {Tree2, _} = erl_recomment:recomment_tree(Tree, Comments),
>> erl_prettypr:format(Tree2).
>>
>
> hello andrew,
>
> this looks interesting, though i cannot find a way to parse a whole mudule:
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%
> -module(pretty).
> -compile(export_all).
>
> start() ->
> Code = "-module(start).
> -export([start/0]).
>
> start() ->ok.
>
> % a comment here.",
> Comments = erl_comment_scan:string(Code),
>  {ok, Form, _} = erl_scan:string(Code),
> {ok, Tree} = erl_parse:parse_form(Form),
>  {Tree2, _} = erl_recomment:recomment_tree(Tree, Comments),
> erl_prettypr:format(Tree2).
> %%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
> 1> pretty:start().
> ** exception error: no match of right hand side value
> {error,{2,erl_parse,["syntax error before: ","'-'"]}}
>      in function  pretty:start/0 (pretty.erl, line 13)
>
> any ideas?
>
> r.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120513/3d17e916/attachment.htm>


More information about the erlang-questions mailing list