Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
58b44ee5
Commit
58b44ee5
authored
Jun 08, 2015
by
David Hauzar
Browse files
Interleaving a source code with counter-example model - enhancements.
parent
a2002302
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/model_parser.ml
View file @
58b44ee5
...
...
@@ -178,30 +178,35 @@ let get_padding line =
Str
.
matched_string
line
with
Not_found
->
""
let
interleave_line
model_file
(
source_code
,
line_number
)
line
=
let
interleave_line
start_comment
end_comment
model_file
(
source_code
,
line_number
)
line
=
try
let
model_elements
=
IntMap
.
find
line_number
model_file
in
print_model_elements
str_formatter
model_elements
~
delimiter
:
"; "
;
let
line_model
=
let
cntexmp_line
=
(
get_padding
line
)
^
"(* "
^
start_comment
^
(
flush_str_formatter
()
)
^
"*)"
in
end_comment
in
(
source_code
^
line
_model
^
"
\n
"
^
line
,
line_number
+
1
)
(
source_code
^
line
^
cntexmp_line
^
"
\n
"
,
line_number
+
1
)
with
Not_found
->
(
source_code
^
line
,
line_number
+
1
)
let
interleave_with_source
model
filename
source_code
=
let
interleave_with_source
?
(
start_comment
=
"(* "
)
?
(
end_comment
=
" *)"
)
model
filename
source_code
=
try
let
model_file
=
StringMap
.
find
filename
model
in
let
lines
=
Str
.
split
(
Str
.
regexp
"^"
)
source_code
in
let
(
source_code
,
_
)
=
List
.
fold_left
(
interleave_line
model_file
)
(
""
,
1
)
lines
in
(
interleave_line
start_comment
end_comment
model_file
)
(
""
,
1
)
lines
in
source_code
with
Not_found
->
source_code
...
...
src/core/model_parser.mli
View file @
58b44ee5
...
...
@@ -106,7 +106,13 @@ val print_model_json : Format.formatter -> model -> unit
val
model_to_string_json
:
model
->
string
val
interleave_with_source
:
model
->
string
->
string
->
string
val
interleave_with_source
:
?
start_comment
:
string
->
?
end_comment
:
string
->
model
->
string
->
string
->
string
(*
***************************************************************
...
...
Write
Preview
Supports
Markdown
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