Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
121
Issues
121
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
58b44ee5
Commit
58b44ee5
authored
Jun 08, 2015
by
David Hauzar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interleaving a source code with counter-example model - enhancements.
parent
a2002302
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
src/core/model_parser.ml
src/core/model_parser.ml
+14
-9
src/core/model_parser.mli
src/core/model_parser.mli
+7
-1
No files found.
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
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