Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
i7
peregrine
Commits
b3727a3e
Commit
b3727a3e
authored
Jul 17, 2014
by
Philipp Meyer
Browse files
Added option to ignore properties given in the input
parent
9ace6b79
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Main.hs
View file @
b3727a3e
...
...
@@ -46,6 +46,7 @@ data Options = Options { inputFormat :: InputFormat
,
optTransformations
::
[
NetTransformation
]
,
optRefine
::
Bool
,
optOutput
::
Maybe
String
,
optUseProperties
::
Bool
}
startOptions
::
Options
...
...
@@ -57,6 +58,7 @@ startOptions = Options { inputFormat = PNET
,
optTransformations
=
[]
,
optRefine
=
True
,
optOutput
=
Nothing
,
optUseProperties
=
True
}
options
::
[
OptDescr
(
Options
->
Either
String
Options
)
]
...
...
@@ -140,6 +142,12 @@ options =
"FILE"
)
"Write net and properties to FILE"
,
Option
""
[
"no-given-properties"
]
(
NoArg
(
\
opt
->
Right
opt
{
optUseProperties
=
False
}))
"Do not use the properties given in the input file"
,
Option
"v"
[
"verbose"
]
(
NoArg
(
\
opt
->
Right
opt
{
optVerbosity
=
optVerbosity
opt
+
1
}))
"Increase verbosity (may be specified more than once)"
...
...
@@ -185,21 +193,22 @@ writeFiles verbosity basename net props = do
checkFile
::
Parser
(
PetriNet
,[
Property
])
->
Int
->
Bool
->
[
ImplicitProperty
]
->
[
NetTransformation
]
->
Maybe
String
->
String
->
IO
Bool
Bool
->
Maybe
String
->
String
->
IO
Bool
checkFile
parser
verbosity
refine
implicitProperties
transformations
output
file
=
do
useProperties
output
file
=
do
verbosePut
verbosity
0
$
"Reading
\"
"
++
file
++
"
\"
"
(
net
,
props
)
<-
parseFile
parser
file
let
props'
=
props
++
map
(
makeImplicitProperty
net
)
implicitProperties
let
(
net'
,
props''
)
=
foldl
transformNet
(
net
,
props'
)
transformations
let
props'
=
if
useProperties
then
props
else
[]
let
props''
=
props'
++
map
(
makeImplicitProperty
net
)
implicitProperties
let
(
net'
,
props'''
)
=
foldl
transformNet
(
net
,
props''
)
transformations
verbosePut
verbosity
1
$
"Analyzing "
++
showNetName
net
verbosePut
verbosity
2
$
"Places: "
++
show
(
length
$
places
net'
)
++
"; "
++
"Transitions: "
++
show
(
length
$
transitions
net'
)
verbosePut
verbosity
3
$
show
net'
rs
<-
mapM
(
checkProperty
verbosity
net'
refine
)
props''
rs
<-
mapM
(
checkProperty
verbosity
net'
refine
)
props''
'
case
output
of
Just
outputfile
->
writeFiles
verbosity
outputfile
net'
props''
Just
outputfile
->
writeFiles
verbosity
outputfile
net'
props''
'
Nothing
->
return
()
verbosePut
verbosity
0
""
return
$
and
rs
...
...
@@ -359,7 +368,8 @@ main = do
let
properties
=
reverse
$
optProperties
opts
let
transformations
=
reverse
$
optTransformations
opts
rs
<-
mapM
(
checkFile
parser
verbosity
refinement
properties
transformations
(
optOutput
opts
))
files
transformations
(
optUseProperties
opts
)
(
optOutput
opts
))
files
if
and
rs
then
exitSuccessWith
"All properties satisfied."
else
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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