From e47b25ec4244049404b8ff8fd64a66ad137f1012 Mon Sep 17 00:00:00 2001 From: Julien Girard-Satabin <julien.girard2@cea.fr> Date: Mon, 24 Feb 2025 10:46:09 +0100 Subject: [PATCH] [json] Remove JSON module altogether --- src/main.ml | 2 +- src/verification_types.ml | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.ml b/src/main.ml index f52712d..38bd6e9 100644 --- a/src/main.ml +++ b/src/main.ml @@ -182,7 +182,7 @@ let record_verification_result verification_result file = verification_result let verify_json ?memlimit ?timelimit ?outfile json = - let query = Json.to_query json in + let query = Verification_types.Query.of_json json in let query = (* Precedence to the command line option, if any. *) (* TODO: * get proper default value instead of defining it twice in diff --git a/src/verification_types.ml b/src/verification_types.ml index 7805f37..a2ca296 100644 --- a/src/verification_types.ml +++ b/src/verification_types.ml @@ -93,6 +93,16 @@ module Query = struct dataset; } + let of_json s = + match of_yojson (Yojson.Safe.from_file s) with + | Ok t -> t + | Error msg -> + invalid_arg + (Fmt.str "Unrecognized JSON configuration in file '%s' (%s)" s msg) + | exception Yojson.Json_error msg -> + failwith + (Fmt.str "Unexpected error while parsing JSON file '%s' (%s)" s msg) + let pretty fmt = Fmt.fmt "%a" fmt pp end -- GitLab