From 51c43721beb1f4af1e903360c0fbc5c1790f1ab5 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Fri, 24 May 2024 15:56:34 +0200 Subject: Start adding markers --- compiler/Print.ml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'compiler/Print.ml') diff --git a/compiler/Print.ml b/compiler/Print.ml index f7f1f54b..12506274 100644 --- a/compiler/Print.ml +++ b/compiler/Print.ml @@ -148,6 +148,12 @@ module Values = struct | AEndedProjBorrows _mv -> "_" | AIgnoredProjBorrows -> "_" + let add_proj_marker (pm : proj_marker) (s : string) : string = + match pm with + | PNone -> s + | PLeft -> "|" ^ s ^ "|" + | PRight -> "┊" ^ s ^ "┊" + let rec typed_avalue_to_string ?(span : Meta.span option = None) (env : fmt_env) (v : typed_avalue) : string = match v.value with @@ -197,17 +203,19 @@ module Values = struct and aloan_content_to_string ?(span : Meta.span option = None) (env : fmt_env) (lc : aloan_content) : string = match lc with - | AMutLoan (bid, av) -> + | AMutLoan (pm, bid, av) -> "@mut_loan(" ^ BorrowId.to_string bid ^ ", " ^ typed_avalue_to_string ~span env av ^ ")" - | ASharedLoan (loans, v, av) -> + |> add_proj_marker pm + | ASharedLoan (pm, loans, v, av) -> let loans = BorrowId.Set.to_string None loans in "@shared_loan(" ^ loans ^ ", " ^ typed_value_to_string ~span env v ^ ", " ^ typed_avalue_to_string ~span env av ^ ")" + |> add_proj_marker pm | AEndedMutLoan ml -> "@ended_mut_loan{" ^ typed_avalue_to_string ~span env ml.child @@ -238,11 +246,13 @@ module Values = struct and aborrow_content_to_string ?(span : Meta.span option = None) (env : fmt_env) (bc : aborrow_content) : string = match bc with - | AMutBorrow (bid, av) -> + | AMutBorrow (pm, bid, av) -> "mb@" ^ BorrowId.to_string bid ^ " (" ^ typed_avalue_to_string ~span env av ^ ")" - | ASharedBorrow bid -> "sb@" ^ BorrowId.to_string bid + |> add_proj_marker pm + | ASharedBorrow (pm, bid) -> + "sb@" ^ BorrowId.to_string bid |> add_proj_marker pm | AIgnoredMutBorrow (opt_bid, av) -> "@ignored_mut_borrow(" ^ option_to_string BorrowId.to_string opt_bid -- cgit v1.2.3 From 9a860ae3ac5f0fdd4430ba39315456c0396e55e7 Mon Sep 17 00:00:00 2001 From: Aymeric Fromherz Date: Thu, 30 May 2024 13:01:06 +0200 Subject: More lisible sign for proj_right pretty-printing --- compiler/Print.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/Print.ml') diff --git a/compiler/Print.ml b/compiler/Print.ml index 12506274..9a3a7d16 100644 --- a/compiler/Print.ml +++ b/compiler/Print.ml @@ -152,7 +152,7 @@ module Values = struct match pm with | PNone -> s | PLeft -> "|" ^ s ^ "|" - | PRight -> "┊" ^ s ^ "┊" + | PRight -> "︙" ^ s ^ "︙" let rec typed_avalue_to_string ?(span : Meta.span option = None) (env : fmt_env) (v : typed_avalue) : string = -- cgit v1.2.3 From 18623d7ee894a8e21bca9ef58fb4087cb4be558b Mon Sep 17 00:00:00 2001 From: Son Ho Date: Mon, 3 Jun 2024 12:08:36 +0200 Subject: Make minor modifications --- compiler/Print.ml | 1 + 1 file changed, 1 insertion(+) (limited to 'compiler/Print.ml') diff --git a/compiler/Print.ml b/compiler/Print.ml index 9a3a7d16..7495d6bf 100644 --- a/compiler/Print.ml +++ b/compiler/Print.ml @@ -148,6 +148,7 @@ module Values = struct | AEndedProjBorrows _mv -> "_" | AIgnoredProjBorrows -> "_" + (** Wrap a value inside its marker, if there is one *) let add_proj_marker (pm : proj_marker) (s : string) : string = match pm with | PNone -> s -- cgit v1.2.3