From f7c578299b539b502fc5cd60e8494e6096d17e1f Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 9 Jan 2025 17:23:24 +0100 Subject: [PATCH] dune fmt --- core/KaSa_rep/frontend/cckappa_sig.mli | 2 +- core/KaSa_rep/frontend/handler.ml | 12 ++++++-- core/KaSa_rep/frontend/preprocess.ml | 2 +- .../remanent_state/remanent_state.mli | 7 ++++- core/grammar/lKappa_compiler.ml | 28 +++++++++++-------- core/term/lKappa.ml | 2 +- 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/core/KaSa_rep/frontend/cckappa_sig.mli b/core/KaSa_rep/frontend/cckappa_sig.mli index 5ac665256..ca16954b0 100644 --- a/core/KaSa_rep/frontend/cckappa_sig.mli +++ b/core/KaSa_rep/frontend/cckappa_sig.mli @@ -204,7 +204,7 @@ type compil = { (*initial graph declaration*) perturbations: (mixture, rule) Ckappa_sig.perturbation Int_storage.Nearly_inf_Imperatif.t; - guard_params: string list;(*rTODO make this a Int_storage not a list*) + guard_params: string list; (*rTODO make this a Int_storage not a list*) } (*******************************************************) diff --git a/core/KaSa_rep/frontend/handler.ml b/core/KaSa_rep/frontend/handler.ml index e72375242..5b50f2674 100644 --- a/core/KaSa_rep/frontend/handler.ml +++ b/core/KaSa_rep/frontend/handler.ml @@ -243,7 +243,11 @@ let info_of_rule parameters ?(with_rates = false) ?(original = false) error | false, false -> rule.Cckappa_sig.e_rule_rule.Ckappa_sig.ast_no_rate in let guard_params = compiled.Cckappa_sig.guard_params in - let guard = Option.map (LKappa_compiler.guard_param_to_string guard_params) rule.Cckappa_sig.e_rule_c_rule.Cckappa_sig.guard in + let guard = + Option.map + (LKappa_compiler.guard_param_to_string guard_params) + rule.Cckappa_sig.e_rule_c_rule.Cckappa_sig.guard + in error, (label, position, direction, ast, guard, rule_id) let hide rule = { rule with Public_data.rule_hidden = true } @@ -326,10 +330,12 @@ let string_of_info ?(with_rule = true) ?(with_rule_name = true) let guard = match guard with | None -> "" - | Some guard -> "#[" ^ LKappa.string_of_guard guard ^ "]" in + | Some guard -> "#[" ^ LKappa.string_of_guard guard ^ "]" + in let s = match label, pos, ast, id with - | "", "", "", s | "", "", s, _ | "", s, "", _ | s, "", _, _ -> prefix ^ guard ^ s + | "", "", "", s | "", "", s, _ | "", s, "", _ | s, "", _, _ -> + prefix ^ guard ^ s | "", s2, s1, _ | s1, s2, _, _ -> prefix ^ guard ^ s1 ^ " (" ^ s2 ^ ")" in s diff --git a/core/KaSa_rep/frontend/preprocess.ml b/core/KaSa_rep/frontend/preprocess.ml index fd4b21196..464963792 100644 --- a/core/KaSa_rep/frontend/preprocess.ml +++ b/core/KaSa_rep/frontend/preprocess.ml @@ -2329,7 +2329,7 @@ let translate_c_compil parameters error handler compil = Cckappa_sig.observables = c_observables; Cckappa_sig.init = c_inits; Cckappa_sig.perturbations = c_perturbations; - Cckappa_sig.guard_params = guard_params; + Cckappa_sig.guard_params; } ) let declare_agent parameters error ag sol = diff --git a/core/KaSa_rep/remanent_state/remanent_state.mli b/core/KaSa_rep/remanent_state/remanent_state.mli index b18fe9e78..f2f7abe46 100644 --- a/core/KaSa_rep/remanent_state/remanent_state.mli +++ b/core/KaSa_rep/remanent_state/remanent_state.mli @@ -33,7 +33,12 @@ type var_id = int type dead_agents = Public_data.agent_kind list val info_to_rule : - string * Loc.t * Public_data.rule_direction * string * string LKappa.guard option * Ckappa_sig.c_rule_id -> + string + * Loc.t + * Public_data.rule_direction + * string + * string LKappa.guard option + * Ckappa_sig.c_rule_id -> Public_data.rule val info_to_agent : diff --git a/core/grammar/lKappa_compiler.ml b/core/grammar/lKappa_compiler.ml index 2d56390bb..c041826f0 100644 --- a/core/grammar/lKappa_compiler.ml +++ b/core/grammar/lKappa_compiler.ml @@ -2538,19 +2538,25 @@ let rec guard_param_conversion convert guard_params g = | Param p -> Param (convert p guard_params) | Not g1 -> Not (guard_param_conversion convert guard_params g1) | And (g1, g2) -> - And (guard_param_conversion convert guard_params g1, guard_param_conversion convert guard_params g2) + And + ( guard_param_conversion convert guard_params g1, + guard_param_conversion convert guard_params g2 ) | Or (g1, g2) -> - Or (guard_param_conversion convert guard_params g1 , guard_param_conversion convert guard_params g2) - -let guard_param_to_int = guard_param_conversion (fun p guard_params -> match List.find_index (fun x -> String.equal p x) guard_params with - | Some i -> i - | None -> - raise - (ExceptionDefn.Malformed_Decl ("Unknown guard parameter", Loc.dummy))) + Or + ( guard_param_conversion convert guard_params g1, + guard_param_conversion convert guard_params g2 ) + +let guard_param_to_int = + guard_param_conversion (fun p guard_params -> + match List.find_index (fun x -> String.equal p x) guard_params with + | Some i -> i + | None -> + raise + (ExceptionDefn.Malformed_Decl ("Unknown guard parameter", Loc.dummy))) -let guard_param_to_string = guard_param_conversion (fun p guard_params -> - List.nth guard_params p (*rTODO error handling*) - ) +let guard_param_to_string = + guard_param_conversion (fun p guard_params -> + List.nth guard_params p (*rTODO error handling*)) let guard_params_to_int_option guard_params g = Option.map (guard_param_to_int guard_params) g diff --git a/core/term/lKappa.ml b/core/term/lKappa.ml index aeaef2531..bf60aaf6b 100644 --- a/core/term/lKappa.ml +++ b/core/term/lKappa.ml @@ -516,7 +516,7 @@ let rec string_of_guard g = | Param i -> i | And (a, b) -> string_of_guard a ^ " && " ^ string_of_guard b | Or (a, b) -> string_of_guard a ^ " || " ^ string_of_guard b - | Not a -> "[not] " ^ string_of_guard a + | Not a -> "[not] " ^ string_of_guard a let rec print_guard f g = match g with