Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
i7
peregrine
Commits
93273f58
Commit
93273f58
authored
Jan 19, 2018
by
Stefan Jaax
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change formula format
parent
4df299f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
src/Parser/PP.hs
src/Parser/PP.hs
+9
-11
No files found.
src/Parser/PP.hs
View file @
93273f58
...
...
@@ -27,13 +27,13 @@ languageDef =
Token
.
commentStart
=
"/*"
,
Token
.
commentEnd
=
"*/"
,
Token
.
commentLine
=
"//"
,
Token
.
identStart
=
letter
<|>
char
'_'
,
Token
.
identStart
=
alphaNum
<|>
letter
<|>
char
'_'
,
Token
.
identLetter
=
alphaNum
<|>
char
'_'
,
Token
.
reservedNames
=
[
"true"
,
"false"
,
"EXISTS"
,
"FORALL"
],
Token
.
reservedOpNames
=
[
"->"
,
"<"
,
"<="
,
"="
,
"!="
,
">="
,
">"
,
"+"
,
"-"
,
"*"
,
"&&"
,
"||"
,
"!"
,
":"
]
}
lexer
::
Token
.
TokenParser
()
lexer
=
Token
.
makeTokenParser
languageDef
...
...
@@ -71,7 +71,7 @@ numberOption :: Parser Integer
numberOption
=
option
1
(
brackets
natural
)
ident
::
Parser
String
ident
=
(
identifier
<|>
stringLiteral
)
<?>
"identifier"
ident
=
(
char
'C'
*>
brackets
(
identifier
<|>
stringLiteral
)
)
<?>
"identifier"
identList
::
Parser
[
String
]
identList
=
singleOrList
ident
...
...
@@ -152,13 +152,13 @@ instance FromJSON (QuantFormula String) where
instance
ToJSON
(
QuantFormula
String
)
where
toJSON
x
=
String
""
data
RecordTransition
=
RecordTransition
{
data
RecordTransition
=
RecordTransition
{
name
::
String
,
pre
::
[
String
],
post
::
[
String
]
}
deriving
(
Show
)
data
RecordPP
=
RecordPP
{
data
RecordPP
=
RecordPP
{
title
::
String
,
states
::
[
String
],
transitions
::
[
RecordTransition
],
...
...
@@ -172,20 +172,18 @@ $(deriveJSON defaultOptions ''RecordTransition)
$
(
deriveJSON
defaultOptions
''RecordPP
)
recordPP2PopulationProtocol
::
RecordPP
->
PopulationProtocol
recordPP2PopulationProtocol
r
=
recordPP2PopulationProtocol
r
=
makePopulationProtocolFromStrings
(
title
r
)
(
states
r
)
(
map
name
(
transitions
r
))
(
initialStates
r
)
(
trueStates
r
)
falseStates
p
arcs
where
falseStates
=
[
q
|
q
<-
states
r
,
not
(
S
.
member
q
(
S
.
fromList
(
trueStates
r
)))]
arcs
=
[(
q
,
name
t
,
1
)
|
t
<-
transitions
r
,
q
<-
pre
t
]
++
arcs
=
[(
q
,
name
t
,
1
)
|
t
<-
transitions
r
,
q
<-
pre
t
]
++
[(
name
t
,
q
,
1
)
|
t
<-
transitions
r
,
q
<-
post
t
]
p
=
case
predicate
r
of
Nothing
->
ExQuantFormula
[]
FTrue
p
=
case
predicate
r
of
Nothing
->
ExQuantFormula
[]
FTrue
(
Just
p'
)
->
p'
parseContent
::
Parser
PopulationProtocol
parseContent
=
do
parseContent
=
do
str
<-
manyTill
anyChar
eof
let
r
=
eitherDecode
(
BS
.
pack
str
)
case
r
of
(
Left
e
)
->
fail
e
(
Right
pp
)
->
return
(
recordPP2PopulationProtocol
pp
)
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