diff options
Diffstat (limited to 'lib/hipe/cerl/cerl_prettypr.erl')
-rw-r--r-- | lib/hipe/cerl/cerl_prettypr.erl | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/hipe/cerl/cerl_prettypr.erl b/lib/hipe/cerl/cerl_prettypr.erl index fba9a48cda..60926e16e1 100644 --- a/lib/hipe/cerl/cerl_prettypr.erl +++ b/lib/hipe/cerl/cerl_prettypr.erl @@ -62,7 +62,10 @@ receive_action/1, receive_clauses/1, receive_timeout/1, seq_arg/1, seq_body/1, string_lit/1, try_arg/1, try_body/1, try_vars/1, try_evars/1, try_handler/1, - tuple_es/1, type/1, values_es/1, var_name/1]). + tuple_es/1, type/1, values_es/1, var_name/1, + + map_es/1, map_pair_assoc_es/1, map_pair_exact_es/1 + ]). -define(PAPER, 76). -define(RIBBON, 45). @@ -424,6 +427,12 @@ lay_1(Node, Ctxt) -> lay_cons(Node, Ctxt); tuple -> lay_tuple(Node, Ctxt); + map -> + lay_map(Node, Ctxt); + map_pair_assoc -> + lay_map_pair_assoc(Node, Ctxt); + map_pair_exact -> + lay_map_pair_exact(Node, Ctxt); 'let' -> lay_let(Node, Ctxt); seq -> @@ -589,6 +598,24 @@ lay_tuple(Node, Ctxt) -> Ctxt, fun lay/2)), floating(text("}")))). +lay_map(Node, Ctxt) -> + beside(floating(text("~{")), + beside(par(seq(map_es(Node), floating(text(",")), + Ctxt, fun lay/2)), + floating(text("}~")))). + +lay_map_pair_assoc(Node, Ctxt) -> + [K,V] = map_pair_assoc_es(Node), + beside(floating(text("::<")), + beside(lay(K,Ctxt),beside(floating(text(",")), beside(lay(V,Ctxt), + floating(text(">")))))). + +lay_map_pair_exact(Node, Ctxt) -> + [K,V] = map_pair_exact_es(Node), + beside(floating(text("~<")), + beside(lay(K,Ctxt),beside(floating(text(",")), beside(lay(V,Ctxt), + floating(text(">")))))). + lay_let(Node, Ctxt) -> V = lay_value_list(let_vars(Node), Ctxt), D1 = par([follow(text("let"), |