Merge branch 'rinderknecht@pprint' of gitlab.com:ligolang/ligo into rinderknecht@pprint

This commit is contained in:
Christian Rinderknecht 2020-05-28 12:57:06 +02:00
commit 4779d12295
2 changed files with 23 additions and 5 deletions

View File

@ -57,6 +57,9 @@ let%expect_test _ =
Subcommand: Preprocess the source file. Warning: Intended for Subcommand: Preprocess the source file. Warning: Intended for
development of LIGO and can break at any time. development of LIGO and can break at any time.
pretty-print
Subcommand: Pretty-print the source file.
print-ast print-ast
Subcommand: Print the AST. Warning: Intended for development of Subcommand: Print the AST. Warning: Intended for development of
LIGO and can break at any time. LIGO and can break at any time.
@ -148,6 +151,9 @@ let%expect_test _ =
Subcommand: Preprocess the source file. Warning: Intended for Subcommand: Preprocess the source file. Warning: Intended for
development of LIGO and can break at any time. development of LIGO and can break at any time.
pretty-print
Subcommand: Pretty-print the source file.
print-ast print-ast
Subcommand: Print the AST. Warning: Intended for development of Subcommand: Print the AST. Warning: Intended for development of
LIGO and can break at any time. LIGO and can break at any time.

View File

@ -453,8 +453,15 @@ fun_expr(right_expr):
) )
| EAnnot {region; value = {inside = EVar v, colon, typ; _}} -> | EAnnot {region; value = {inside = EVar v, colon, typ; _}} ->
Scoping.check_reserved_name v; Scoping.check_reserved_name v;
let value = {pattern = PVar v; colon; type_expr = typ} let value = {pattern = PVar v; colon; type_expr = typ} in
in PTyped {region; value} PPar {
value = {
lpar = Region.ghost;
rpar = Region.ghost;
inside = PTyped {region; value}
};
region
}
| EPar p -> | EPar p ->
let value = let value =
{p.value with inside = arg_to_pattern p.value.inside} {p.value with inside = arg_to_pattern p.value.inside}
@ -494,7 +501,13 @@ fun_expr(right_expr):
(arg_to_pattern fun_arg, []) (arg_to_pattern fun_arg, [])
| EPar {value = {inside = EFun { | EPar {value = {inside = EFun {
value = { value = {
binders = PTyped { value = { pattern; colon; type_expr }; region = fun_region }, []; binders = PPar {
value = {
inside = PTyped { value = { pattern; colon; type_expr }; region = fun_region };
_
};
_
}, [];
arrow; arrow;
body; body;
_ _
@ -655,7 +668,6 @@ disj_expr_level:
| par(tuple(disj_expr_level)) type_annotation_simple? { | par(tuple(disj_expr_level)) type_annotation_simple? {
let region = nsepseq_to_region expr_to_region $1.value.inside in let region = nsepseq_to_region expr_to_region $1.value.inside in
let tuple = ETuple {value=$1.value.inside; region} in let tuple = ETuple {value=$1.value.inside; region} in
let tuple = EPar {$1 with value = {$1.value with inside=tuple}} in
let region = let region =
match $2 with match $2 with
Some (_,s) -> cover $1.region (type_expr_to_region s) Some (_,s) -> cover $1.region (type_expr_to_region s)