Maj terminée. Pour consulter la release notes associée voici le lien :

Commit 01f845fe authored by David Hauzar's avatar David Hauzar
Browse files

Filtering outs given positions from the model counter-example model.

parent 3c0b1f7c
......@@ -311,6 +311,48 @@ let build_model raw_model printer_mapping =
build_model_rec raw_model printer_mapping.queried_terms empty_model
** Filtering the model
let add_loc orig_model new_model position =
(* Add a given location from orig_model to new_model *)
let (file_name, line_num, _, _) = (Loc.get position) in
let orig_model_file = get_model_file orig_model file_name in
let new_model_file = get_model_file new_model file_name in
if IntMap.mem line_num new_model_file then
(* the location already is in new_model *)
(* get the location from original model *)
let line_map = IntMap.find line_num orig_model_file in
(* add the location to new model *)
let new_model_file = IntMap.add line_num line_map new_model_file in
StringMap.add file_name new_model_file new_model
with Not_found ->
let add_first_model_line filename model_file model =
let (line_num, cnt_info) = IntMap.min_binding model_file in
let mf = get_model_file model filename in
let mf = IntMap.add line_num cnt_info mf in
StringMap.add filename mf model
let model_for_positions_and_decls model ~positions =
(* Start with empty model and add locations from model that
are in locations *)
let model_filtered = List.fold_left (add_loc model) empty_model positions in
(* For each file add mapping corresponding to the first line of the
counter-example from model to model_filtered.
This corresponds to function declarations *)
StringMap.fold add_first_model_line model model_filtered
** Registering model parser
......@@ -114,6 +114,25 @@ val interleave_with_source :
string ->
** Filtering the model
val model_for_positions_and_decls : model ->
positions: Loc.position list -> model
(** Given a model and a list of source-code positions returns model
that contains only elements from the input model that are on these
positions plus for every file in the model, elements that are
in the positions of function declarations. Elements with other
positions are filtered out.
Assumes that for each file the element on the first line of the model
has position of function declaration.
Only filename and line number is used to identify positions.
** Registering model parser
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment