Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
properties
Commits
c20dbdb3
Commit
c20dbdb3
authored
Mar 16, 2015
by
Maxime Perrotin
Browse files
Parse properties in one shot
parent
5ba1bf19
Changes
2
Hide whitespace changes
Inline
Side-by-side
properties/properties.py
View file @
c20dbdb3
...
...
@@ -49,24 +49,24 @@ def parse_input_files(pr_files, ppty_file):
log
.
info
(
'SDL parser OK'
)
# Parse the stop conditions (property file)
stop_conditions
=
[]
with
open
(
ppty_file
,
'r'
)
as
ppties
:
for
line
in
ppties
.
readlines
():
if
not
line
.
strip
():
continue
expr
,
syntax
,
semantic
,
warnings
,
term
=
\
opengeode
.
ogParser
.
parseSingleElement
(
'stop_if'
,
line
,
process
)
if
syntax
or
semantic
or
warnings
:
log
.
error
(
'Error in expression: {}'
.
format
(
line
))
else
:
stop_conditions
.
append
(
expr
)
with
open
(
ppty_file
,
'r'
)
as
pt
:
stop_conditions
,
syntax
,
semantic
,
warnings
,
term
=
\
opengeode
.
ogParser
.
parseSingleElement
(
'stop_if'
,
pt
.
read
(),
process
)
for
each
in
syntax
:
log
.
error
(
each
)
for
each
in
semantic
:
log
.
error
(
each
[
0
])
for
each
in
warnings
:
log
.
warning
(
each
[
0
])
if
syntax
or
semantic
or
warnings
or
not
stop_conditions
:
raise
IOError
(
'Error parsing stop conditions - Aborting'
)
# Set the context in the Ada generator
if
stop_conditions
:
opengeode
.
AdaGenerator
.
TYPES
=
process
.
dataview
opengeode
.
AdaGenerator
.
VARIABLES
=
process
.
variables
opengeode
.
AdaGenerator
.
PROCEDURES
=
process
.
procedures
opengeode
.
AdaGenerator
.
OUT_SIGNALS
=
process
.
output_signals
opengeode
.
AdaGenerator
.
TYPES
=
process
.
dataview
opengeode
.
AdaGenerator
.
VARIABLES
=
process
.
variables
opengeode
.
AdaGenerator
.
PROCEDURES
=
process
.
procedures
opengeode
.
AdaGenerator
.
OUT_SIGNALS
=
process
.
output_signals
# Generate Ada code for each stop condition
for
each
in
stop_conditions
:
...
...
@@ -104,7 +104,10 @@ def cli():
log
.
debug
(
'SDL files: {}'
.
format
(
', '
.
join
(
options
.
models
)))
log
.
debug
(
'Property file: {}'
.
format
(
options
.
spec
))
parse_input_files
(
options
.
models
,
options
.
spec
)
try
:
parse_input_files
(
options
.
models
,
options
.
spec
)
except
IOError
as
err
:
log
.
error
(
str
(
err
))
return
0
...
...
test/properties
View file @
c20dbdb3
stop if a = two
stop if state = timeout
stop if a = two
;
stop if state = timeout
;
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