Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Why3
why3
Commits
01f845fe
Commit
01f845fe
authored
Jul 15, 2015
by
David Hauzar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filtering outs given positions from the model counter-example model.
parent
3c0b1f7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
29 deletions
+90
-29
src/core/model_parser.ml
src/core/model_parser.ml
+42
-0
src/core/model_parser.mli
src/core/model_parser.mli
+48
-29
No files found.
src/core/model_parser.ml
View file @
01f845fe
...
...
@@ -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 *)
new_model
else
try
(* 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
->
new_model
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
...
...
src/core/model_parser.mli
View file @
01f845fe
...
...
@@ -114,6 +114,25 @@ val interleave_with_source :
string
->
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment