mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Tweak printing of if/then/else
This commit is contained in:
parent
4ae949f7f8
commit
3cb8fc1499
@ -586,7 +586,8 @@ let rec expr_aux :
|
|||||||
| EIfThenElse _ ->
|
| EIfThenElse _ ->
|
||||||
let rec pr els fmt = function
|
let rec pr els fmt = function
|
||||||
| EIfThenElse { cond; etrue; efalse }, _ ->
|
| EIfThenElse { cond; etrue; efalse }, _ ->
|
||||||
Format.fprintf fmt "@[<hv 2>%a@ %a@]@ @[<hv 2>%a@ %a@]@ %a" keyword
|
Format.fprintf fmt "@[<hv 2>@[<hv 2>%a@ %a@;<1 -2>%a@]@ %a@]@ %a"
|
||||||
|
keyword
|
||||||
(if els then "else if" else "if")
|
(if els then "else if" else "if")
|
||||||
expr cond keyword "then" expr etrue (pr true) efalse
|
expr cond keyword "then" expr etrue (pr true) efalse
|
||||||
| e -> Format.fprintf fmt "@[<hv 2>%a@ %a@]" keyword "else" (rhs exprc) e
|
| e -> Format.fprintf fmt "@[<hv 2>%a@ %a@]" keyword "else" (rhs exprc) e
|
||||||
|
@ -71,7 +71,8 @@ let scope S (x: integer|internal|output) =
|
|||||||
to_rat ((2 - i) * (2 - i)))
|
to_rat ((2 - i) * (2 - i)))
|
||||||
< let i : integer = i_2 in
|
< let i : integer = i_2 in
|
||||||
to_rat ((2 - i) * (2 - i))
|
to_rat ((2 - i) * (2 - i))
|
||||||
then i_1
|
then
|
||||||
|
i_1
|
||||||
else i_2)
|
else i_2)
|
||||||
42
|
42
|
||||||
[ 1; 2; 3 ])
|
[ 1; 2; 3 ])
|
||||||
|
@ -34,8 +34,8 @@ let scope S
|
|||||||
| ESome y_0 →
|
| ESome y_0 →
|
||||||
let potential_max_1 : integer = y_0 in
|
let potential_max_1 : integer = y_0 in
|
||||||
let potential_max_2 : integer = y_3 in
|
let potential_max_2 : integer = y_3 in
|
||||||
if potential_max_1 < potential_max_2
|
if potential_max_1 < potential_max_2 then
|
||||||
then ESome potential_max_1
|
ESome potential_max_1
|
||||||
else ESome potential_max_2)
|
else ESome potential_max_2)
|
||||||
ESome -1
|
ESome -1
|
||||||
y_2)
|
y_2)
|
||||||
@ -83,8 +83,8 @@ let scope S
|
|||||||
| ESome y_0 →
|
| ESome y_0 →
|
||||||
let potential_max_1 : integer = y_0 in
|
let potential_max_1 : integer = y_0 in
|
||||||
let potential_max_2 : integer = y_3 in
|
let potential_max_2 : integer = y_3 in
|
||||||
if potential_max_1 < potential_max_2
|
if potential_max_1 < potential_max_2 then
|
||||||
then ESome potential_max_1
|
ESome potential_max_1
|
||||||
else ESome potential_max_2)
|
else ESome potential_max_2)
|
||||||
ESome -1
|
ESome -1
|
||||||
y_2))
|
y_2))
|
||||||
|
@ -171,8 +171,7 @@ let scope Foo
|
|||||||
(match b with
|
(match b with
|
||||||
| ENone _ → ENone _
|
| ENone _ → ENone _
|
||||||
| ESome b →
|
| ESome b →
|
||||||
if b
|
if b then
|
||||||
then
|
|
||||||
match
|
match
|
||||||
(match (SubFoo1 { SubFoo1_in x_in = ESome 10; }).x with
|
(match (SubFoo1 { SubFoo1_in x_in = ESome 10; }).x with
|
||||||
| ENone _ → ENone _
|
| ENone _ → ENone _
|
||||||
|
Loading…
Reference in New Issue
Block a user