mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-19 16:28:12 +03:00
refactor(compiler): minor factorization of formatting functions inside the To_ocaml module
This commit is contained in:
parent
731513a003
commit
ac47d1ff1a
@ -42,13 +42,13 @@ let format_op_kind (fmt : Format.formatter) (k : Dcalc.Ast.op_kind) =
|
|||||||
(match k with KInt -> "!" | KRat -> "&" | KMoney -> "$" | KDate -> "@" | KDuration -> "^")
|
(match k with KInt -> "!" | KRat -> "&" | KMoney -> "$" | KDate -> "@" | KDuration -> "^")
|
||||||
|
|
||||||
let format_log_entry (fmt : Format.formatter) (entry : Dcalc.Ast.log_entry) : unit =
|
let format_log_entry (fmt : Format.formatter) (entry : Dcalc.Ast.log_entry) : unit =
|
||||||
match entry with
|
Format.fprintf fmt "%s"
|
||||||
| VarDef _ -> Format.fprintf fmt ":="
|
(match entry with
|
||||||
| BeginCall -> Format.fprintf fmt "→ "
|
| VarDef _ -> ":="
|
||||||
| EndCall -> Format.fprintf fmt "%s" "← "
|
| BeginCall -> "→ "
|
||||||
| PosRecordIfTrueBool -> Format.fprintf fmt "☛ "
|
| EndCall -> "← "
|
||||||
|
| PosRecordIfTrueBool -> "☛ ")
|
||||||
|
|
||||||
(* TODO: to factorize. *)
|
|
||||||
let format_binop (fmt : Format.formatter) (op : Dcalc.Ast.binop Pos.marked) : unit =
|
let format_binop (fmt : Format.formatter) (op : Dcalc.Ast.binop Pos.marked) : unit =
|
||||||
match Pos.unmark op with
|
match Pos.unmark op with
|
||||||
| Add k -> Format.fprintf fmt "+%a" format_op_kind k
|
| Add k -> Format.fprintf fmt "+%a" format_op_kind k
|
||||||
|
Loading…
Reference in New Issue
Block a user