diff --git a/lib/licDump.ml b/lib/licDump.ml index 419d31ac8c3b333ab548532112070ee4537e76ca..df954169e68496f0f04260d6169c3403f76c6c79 100644 --- a/lib/licDump.ml +++ b/lib/licDump.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 16/11/2023 (at 11:09) by Erwan Jahier> *) +(* Time-stamp: <modified the 16/11/2023 (at 12:16) by Erwan Jahier> *) (* This module is used both for @@ -588,7 +588,10 @@ and (string_of_by_pos_op_eff: bool -> Lic.by_pos_op srcflagged -> Lic.val_exp li || global_opt.one_op_per_equation then - if String.length str >0 && str.[0] <> ' ' then " "^str^ " " else str + let lstr = String.length str in + let str = if lstr>0 && str.[0] <> ' ' then " "^str else str in + let str = if lstr>0 && str.[String.length str - 1] <> ' ' then str^ " " else str in + str else ("(" ^ str ^ ")") @@ -816,16 +819,22 @@ and node_of_node_exp_eff forprint (neff: Lic.node_exp): string = profile_of_node_exp_eff forprint neff ) ^ + let pragma = if global_opt.lv4 then + (Lxm.pragma neff.lxm) |> + List.map (function Pragma(cid,c) -> Printf.sprintf "(*@%s %s*)\n" cid c) |> + String.concat "\n" + else "" + in (match neff.def_eff with - | ExternLic -> ";\n" + | ExternLic -> ";\n" ^ pragma | MetaOpLic -> ( (* on écrit juste un alias *) - " = " ^(string_of_node_key_def forprint neff.node_key_eff)^ ";\n" + " = " ^(string_of_node_key_def forprint neff.node_key_eff)^ ";\n" ^ pragma ) - | AbstractLic _ -> "; \n" + | AbstractLic _ -> "; \n" ^ pragma | BodyLic _ -> ( - (if global_opt.kcg then "\n" else ";\n") ^ + (if global_opt.kcg then "\n" else ";\n" ^ pragma) ^ (match neff.loclist_eff with | None -> "" | Some [] -> ""