Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 702e2659 authored by David Hauzar's avatar David Hauzar
Browse files

Printing counterexample arrays made compatible with json format.

parent 048d5150
No related branches found
No related tags found
No related merge requests found
...@@ -60,29 +60,31 @@ let array_add_element ~array ~index ~value = ...@@ -60,29 +60,31 @@ let array_add_element ~array ~index ~value =
arr_indices = arr_index::array.arr_indices; arr_indices = arr_index::array.arr_indices;
} }
let rec print_indices sanit_print fmt indices = let rec print_indices fmt indices =
match indices with match indices with
| [] -> () | [] -> ()
| index::tail -> | index::tail ->
fprintf fmt "; %a -> " (print_model_value_sanit sanit_print) index.arr_index_key; fprintf fmt "; %a -> " print_model_value index.arr_index_key;
print_model_value_sanit sanit_print fmt index.arr_index_value; print_model_value fmt index.arr_index_value;
print_indices sanit_print fmt tail print_indices fmt tail
and and
print_array sanit_print fmt arr = print_array fmt arr =
fprintf fmt "{others -> "; fprintf fmt "[others -> ";
print_model_value_sanit sanit_print fmt arr.arr_others; print_model_value fmt arr.arr_others;
print_indices sanit_print fmt arr.arr_indices; print_indices fmt arr.arr_indices;
fprintf fmt "}" fprintf fmt "]"
and and
print_model_value_sanit sanit_print fmt value = print_model_value_sanit sanit_print fmt value =
(* Prints model value. *) (* Prints model value. *)
match value with match value with
| Integer s -> sanit_print fmt s | Integer s -> sanit_print fmt s
| Unparsed s -> sanit_print fmt s | Unparsed s -> sanit_print fmt s
| Array a -> print_array sanit_print fmt a | Array a ->
print_array str_formatter a;
sanit_print fmt (flush_str_formatter ());
| Bitvector v -> sanit_print fmt (string_of_int v) | Bitvector v -> sanit_print fmt (string_of_int v)
and
let print_model_value fmt value = print_model_value fmt value =
print_model_value_sanit (fun fmt s -> fprintf fmt "%s" s) fmt value print_model_value_sanit (fun fmt s -> fprintf fmt "%s" s) fmt value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment