Commit eb83e1f0 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Work on state aggregation (Ada backend)

parent e3146a5e
......@@ -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
......
......@@ -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
......
......@@ -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 = ''
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment