diff --git a/compiler/plugins/explain.ml b/compiler/plugins/explain.ml index 1cfbb18c..83ea8e72 100644 --- a/compiler/plugins/explain.ml +++ b/compiler/plugins/explain.ml @@ -40,7 +40,7 @@ module Style = struct let dark = { page_background = 0x0; - arrows = 0xff7700; + arrows = 0x606060; input = { fill = 0x252526; border = 0xBC3FBC; stroke = 2; text = 0xFFFFFF }; middle = @@ -1227,7 +1227,7 @@ let expr_to_dot_label0 : match o with | Eq_boo_boo | Eq_int_int | Eq_rat_rat | Eq_mon_mon | Eq_dur_dur | Eq_dat_dat | Eq -> - "=" + "=" | Minus_int | Minus_rat | Minus_mon | Minus_dur | Minus -> "-" | ToRat_int | ToRat_mon | ToRat -> "" | ToMoney_rat | ToMoney -> "" @@ -1241,19 +1241,19 @@ let expr_to_dot_label0 : "×" | Div_int_int | Div_rat_rat | Div_mon_mon | Div_mon_rat | Div_dur_dur | Div -> - "/" + "÷" | Lt_int_int | Lt_rat_rat | Lt_mon_mon | Lt_dur_dur | Lt_dat_dat | Lt -> "<" | Lte_int_int | Lte_rat_rat | Lte_mon_mon | Lte_dur_dur | Lte_dat_dat | Lte -> - "<=" + "≤" | Gt_int_int | Gt_rat_rat | Gt_mon_mon | Gt_dur_dur | Gt_dat_dat | Gt -> ">" | Gte_int_int | Gte_rat_rat | Gte_mon_mon | Gte_dur_dur | Gte_dat_dat | Gte -> - ">=" + "≥" | Concat -> "++" | Not -> xlang () ~en:"not" ~fr:"non" | Length -> xlang () ~en:"length" ~fr:"nombre" @@ -1349,11 +1349,6 @@ let htmlencode = | "@" -> "@" | _ -> assert false) -let scale_svg_width s = - let open Re in - let re = Pcre.re " - [`Color 0x606060 (* `Label s; `Color 0xbb7700 *); `Weight 10] + [`Color theme.arrows (* `Label s; `Color 0xbb7700 *); `Weight 10] | { side = None; _ } -> - [`Color 0x606060 (* `Minlen 0; `Weight 10 *); `Weight 10] + [`Color theme.arrows (* `Minlen 0; `Weight 10 *); `Weight 10] end) in let g = (* Add fake edges from everything towards the inputs to force ordering *) @@ -1901,11 +1896,16 @@ let run output_string oc "\n\n\n "; output_string oc (htmlencode ex_scope); Printf.fprintf oc - "\n\n\n" + " \n\ + \ \n\ + \n\ + \n" explain_options.theme.page_background); let contents = File.process_out "dot" ["-T" ^ fmt; dotfile] in - output_string oc - (if wrap_html then scale_svg_width contents else contents); + output_string oc contents; if wrap_html then output_string oc "\n\n") | `Dot -> ()); match explain_options.show with diff --git a/compiler/scopelang/from_desugared.ml b/compiler/scopelang/from_desugared.ml index bca2f8af..fc929e3f 100644 --- a/compiler/scopelang/from_desugared.ml +++ b/compiler/scopelang/from_desugared.ml @@ -863,7 +863,7 @@ let translate_program match states with | D.WholeVar -> WholeVar (ScopeVar.fresh (var_name, var_pos)) | States states -> - let var_prefix = var_name ^ "_" in + let var_prefix = var_name ^ "#" in let state_var state = ScopeVar.fresh (Mark.map (( ^ ) var_prefix) (StateName.get_info state)) diff --git a/tests/variable_state/good/subscope.catala_en b/tests/variable_state/good/subscope.catala_en index cee51ef1..2254cc2c 100644 --- a/tests/variable_state/good/subscope.catala_en +++ b/tests/variable_state/good/subscope.catala_en @@ -44,14 +44,14 @@ $ catala Typecheck --check-invariants ```catala-test-inline $ catala Scopelang -s A -let scope A (foo_bar: ⟨integer⟩|context) (foo_baz: integer|internal) - (foo_fizz: integer|internal|output) = - let foo_bar : integer = reentrant or by default +let scope A (foo#bar: ⟨integer⟩|context) (foo#baz: integer|internal) + (foo#fizz: integer|internal|output) = + let foo#bar : integer = reentrant or by default error_empty ⟨ ⟨true ⊢ ⟨1⟩⟩ | false ⊢ ∅ ⟩; - let foo_baz : integer = - error_empty ⟨ ⟨true ⊢ ⟨foo_bar + 1⟩⟩ | false ⊢ ∅ ⟩; - let foo_fizz : integer = - error_empty ⟨ ⟨true ⊢ ⟨foo_baz + 1⟩⟩ | false ⊢ ∅ ⟩ + let foo#baz : integer = + error_empty ⟨ ⟨true ⊢ ⟨foo#bar + 1⟩⟩ | false ⊢ ∅ ⟩; + let foo#fizz : integer = + error_empty ⟨ ⟨true ⊢ ⟨foo#baz + 1⟩⟩ | false ⊢ ∅ ⟩ ``` ```catala-test-inline