From db1c0fa05a49139ee80c96d33ed75bba63cdf95d Mon Sep 17 00:00:00 2001 From: Robert Virding Date: Fri, 11 Jan 2019 17:41:54 +0100 Subject: [PATCH] Improve pretty printing the code AST --- src/aeso_ast.erl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/aeso_ast.erl b/src/aeso_ast.erl index ee25e15..90e6595 100644 --- a/src/aeso_ast.erl +++ b/src/aeso_ast.erl @@ -17,11 +17,12 @@ line({symbol, Line, _}) -> Line. symbol_name({symbol, _, Name}) -> Name. pp(Ast) -> - %% TODO: Actually do *Pretty* printing. - io:format("~p~n", [Ast]). + %% io:format("Tree:\n~p\n",[Ast]), + String = prettypr:format(aeso_pretty:decls(Ast, [])), + io:format("Ast:\n~s\n", [String]). pp_typed(TypedAst) -> + %% io:format("Typed tree:\n~p\n",[TypedAst]), String = prettypr:format(aeso_pretty:decls(TypedAst, [show_generated])), - %%io:format("Typed tree:\n~p\n",[TypedAst]), - io:format("Type info:\n~s\n",[String]). + io:format("Type ast:\n~s\n",[String]).