ReasonLIGO improvements.
This commit is contained in:
parent
cee9cc841e
commit
a688a1afe4
@ -120,8 +120,8 @@ and pp_ptuple {value; _} =
|
|||||||
| p::items ->
|
| p::items ->
|
||||||
group (break 1 ^^ pp_pattern p ^^ string ",") ^^ app items
|
group (break 1 ^^ pp_pattern p ^^ string ",") ^^ app items
|
||||||
in if tail = []
|
in if tail = []
|
||||||
then string "(" ^^ pp_pattern head ^^ string ")"
|
then string "(" ^^ nest 1 (pp_pattern head) ^^ string ")"
|
||||||
else string "(" ^^ pp_pattern head ^^ string "," ^^ app (List.map snd tail) ^^ string ")"
|
else string "(" ^^ nest 1 (pp_pattern head ^^ string "," ^^ app (List.map snd tail)) ^^ string ")"
|
||||||
|
|
||||||
and pp_precord fields = pp_ne_injection pp_field_pattern fields
|
and pp_precord fields = pp_ne_injection pp_field_pattern fields
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ and pp_expr = function
|
|||||||
|
|
||||||
and pp_case_expr {value; _} =
|
and pp_case_expr {value; _} =
|
||||||
let {expr; cases; _} = value in
|
let {expr; cases; _} = value in
|
||||||
group (string "switch" ^^ string "(" ^^ pp_expr expr ^^ (string ") " ^^ string "{")
|
group (string "switch" ^^ string "(" ^^ nest 1 (pp_expr expr) ^^ (string ") " ^^ string "{")
|
||||||
^^ (pp_cases cases) ^^ hardline ^^ string "}" )
|
^^ (pp_cases cases) ^^ hardline ^^ string "}" )
|
||||||
|
|
||||||
and pp_cases {value; _} =
|
and pp_cases {value; _} =
|
||||||
@ -350,8 +350,8 @@ and pp_tuple_expr {value; _} =
|
|||||||
| e::items ->
|
| e::items ->
|
||||||
group (break 1 ^^ pp_expr e ^^ string ",") ^^ app items
|
group (break 1 ^^ pp_expr e ^^ string ",") ^^ app items
|
||||||
in if tail = []
|
in if tail = []
|
||||||
then string "(" ^^ pp_expr head ^^ string ")"
|
then string "(" ^^ nest 1 (pp_expr head) ^^ string ")"
|
||||||
else string "(" ^^ pp_expr head ^^ string "," ^^ app (List.map snd tail) ^^ string ")"
|
else string "(" ^^ nest 1 (pp_expr head ^^ string "," ^^ app (List.map snd tail)) ^^ string ")"
|
||||||
|
|
||||||
and pp_par_expr {value; _} =
|
and pp_par_expr {value; _} =
|
||||||
string "(" ^^ nest 1 (pp_expr value.inside ^^ string ")")
|
string "(" ^^ nest 1 (pp_expr value.inside ^^ string ")")
|
||||||
@ -378,8 +378,8 @@ and pp_fun {value; _} =
|
|||||||
group (break 0 ^^ string ": " ^^ nest 2 (pp_type_expr e))
|
group (break 0 ^^ string ": " ^^ nest 2 (pp_type_expr e))
|
||||||
in
|
in
|
||||||
match body with
|
match body with
|
||||||
| ESeq _ -> string "(" ^^ binders ^^ string ")" ^^ annot ^^ string " => " ^^ pp_expr body
|
| ESeq _ -> string "(" ^^ nest 1 binders ^^ string ")" ^^ annot ^^ string " => " ^^ pp_expr body
|
||||||
| _ -> (prefix 2 0 (string "(" ^^ binders ^^ string ")" ^^ annot
|
| _ -> (prefix 2 0 (string "(" ^^ nest 1 binders ^^ string ")" ^^ annot
|
||||||
^^ string " => ") (pp_expr body))
|
^^ string " => ") (pp_expr body))
|
||||||
|
|
||||||
and pp_seq {value; _} =
|
and pp_seq {value; _} =
|
||||||
@ -412,7 +412,7 @@ and pp_cartesian {value; _} =
|
|||||||
| e::items ->
|
| e::items ->
|
||||||
group (break 1 ^^ pp_type_expr e ^^ string ",") ^^ app items
|
group (break 1 ^^ pp_type_expr e ^^ string ",") ^^ app items
|
||||||
in
|
in
|
||||||
string "(" ^^ pp_type_expr head ^^ (if tail <> [] then string "," else empty) ^^ app (List.map snd tail) ^^ string ")"
|
string "(" ^^ nest 1 (pp_type_expr head ^^ (if tail <> [] then string "," else empty) ^^ app (List.map snd tail)) ^^ string ")"
|
||||||
|
|
||||||
and pp_variants {value; _} =
|
and pp_variants {value; _} =
|
||||||
let head, tail = value in
|
let head, tail = value in
|
||||||
@ -445,7 +445,7 @@ and pp_field_decl {value; _} =
|
|||||||
|
|
||||||
and pp_type_app {value; _} =
|
and pp_type_app {value; _} =
|
||||||
let ctor, tuple = value in
|
let ctor, tuple = value in
|
||||||
prefix 2 0 (pp_type_constr ctor) (string "(" ^^ pp_type_tuple tuple ^^ string ")")
|
prefix 2 0 (pp_type_constr ctor) (string "(" ^^ nest 1 (pp_type_tuple tuple) ^^ string ")")
|
||||||
|
|
||||||
and pp_type_tuple {value; _} =
|
and pp_type_tuple {value; _} =
|
||||||
let head, tail = value.inside in
|
let head, tail = value.inside in
|
||||||
@ -474,7 +474,7 @@ and pp_fun_type {value; _} =
|
|||||||
match lhs, rhs with
|
match lhs, rhs with
|
||||||
| _, TFun tf -> string "(" ^^ pp_type_expr lhs ^^ string ", " ^^ pp_fun_args tf
|
| _, TFun tf -> string "(" ^^ pp_type_expr lhs ^^ string ", " ^^ pp_fun_args tf
|
||||||
| TVar _ , _ -> group (pp_type_expr lhs ^^ string " =>" ^/^ pp_type_expr rhs)
|
| TVar _ , _ -> group (pp_type_expr lhs ^^ string " =>" ^/^ pp_type_expr rhs)
|
||||||
| _ -> group (string "(" ^^ pp_type_expr lhs ^^ string ")" ^^ string " =>" ^/^ pp_type_expr rhs)
|
| _ -> group (string "(" ^^ nest 1 (pp_type_expr lhs) ^^ string ")" ^^ string " =>" ^/^ pp_type_expr rhs)
|
||||||
|
|
||||||
and pp_type_par {value; _} =
|
and pp_type_par {value; _} =
|
||||||
string "(" ^^ nest 1 (pp_type_expr value.inside ^^ string ")")
|
string "(" ^^ nest 1 (pp_type_expr value.inside ^^ string ")")
|
||||||
|
Loading…
Reference in New Issue
Block a user