Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
eb83e1f0
Commit
eb83e1f0
authored
Oct 17, 2015
by
Maxime Perrotin
Browse files
Work on state aggregation (Ada backend)
parent
e3146a5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
opengeode/AdaGenerator.py
View file @
eb83e1f0
...
...
@@ -1895,12 +1895,27 @@ def _transition(tr, **kwargs):
code
.
append
(
'<<{label}>>'
.
format
(
label
=
tr
.
terminator
.
label
.
inputString
))
if
tr
.
terminator
.
kind
==
'next_state'
:
if
tr
.
terminator
.
inputString
.
strip
()
!=
'-'
:
if
tr
.
terminator
.
next_is_aggregation
:
# XXX add to C generator
code
.
append
(
u
'-- Entering state aggregation {}'
.
format
(
tr
.
terminator
.
inputString
))
code
.
append
(
u
'{};'
.
format
(
tr
.
terminator
.
next_id
))
code
.
append
(
u
'{ctxt}.state := {nextState};'
.
format
(
ctxt
=
LPREFIX
,
nextState
=
tr
.
terminator
.
inputString
))
elif
tr
.
terminator
.
inputString
.
strip
()
!=
'-'
:
code
.
append
(
u
'trId := '
+
unicode
(
tr
.
terminator
.
next_id
)
+
u
';'
)
if
tr
.
terminator
.
next_id
==
-
1
:
code
.
append
(
u
'{ctxt}.state := {nextState};'
.
format
(
ctxt
=
LPREFIX
,
if
not
tr
.
terminator
.
substate
:
code
.
append
(
u
'{ctxt}.state := {nextState};'
.
format
(
ctxt
=
LPREFIX
,
nextState
=
tr
.
terminator
.
inputString
))
else
:
code
.
append
(
u
'{ctxt}.{sub}{sep}state :='
u
' {nextState};'
.
format
(
ctxt
=
LPREFIX
,
sub
=
tr
.
terminator
.
substate
,
sep
=
UNICODE_SEP
,
nextState
=
tr
.
terminator
.
inputString
))
else
:
if
any
(
next_id
...
...
opengeode/Helper.py
View file @
eb83e1f0
...
...
@@ -51,7 +51,7 @@ def state_aggregations(process):
if
isinstance
(
each
,
ogAST
.
StateAggregation
):
for
term
in
comp
.
terminators
:
if
term
.
inputString
.
lower
()
==
each
.
statename
.
lower
():
each
.
next_is_aggregation
=
True
term
.
next_is_aggregation
=
True
if
isinstance
(
comp
,
ogAST
.
StateAggregation
):
aggregates
.
append
(
comp
.
statename
)
elif
aggregate
:
# Elif: no state for an inner state aggregation
...
...
opengeode/ogAST.py
View file @
eb83e1f0
...
...
@@ -464,7 +464,7 @@ class Terminator(object):
# optional composite state content (type CompositeState)
self
.
composite
=
None
# Flag to indicate if the nextstate is a state aggregation
self
.
is_aggregation
=
False
self
.
next_
is_aggregation
=
False
# If this terminator is within a state aggregation, store the name
# of the parallel substate (set by Helper.state_aggregations)
self
.
substate
=
''
...
...
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