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

Support empty procedures

parent c700dd2a
......@@ -1673,8 +1673,10 @@ def _inner_procedure(proc):
# Look for labels in the diagram and transform them in floating labels
Helper.inner_labels_to_floating(proc)
tr_code, tr_decl = generate(proc.content.start.transition)
if proc.content.start:
tr_code, tr_decl = generate(proc.content.start.transition)
else:
tr_code, tr_decl = ['null; -- Empty procedure'], []
# Generate code for the floating labels
code_labels = []
for label in proc.content.floating_labels:
......
......@@ -67,8 +67,9 @@ def inner_labels_to_floating(process):
for proc_tr in process.transitions:
for new_floating in find_labels(proc_tr):
process.content.floating_labels.append(new_floating)
for new_floating in find_labels(process.content.start.transition):
process.content.floating_labels.append(new_floating)
if process.content.start:
for new_floating in find_labels(process.content.start.transition):
process.content.floating_labels.append(new_floating)
for each in process.content.named_start:
for new_floating in find_labels(each.transition):
process.content.floating_labels.append(new_floating)
......
......@@ -21,88 +21,95 @@ dcl check tasTE_Peek_id;
dcl choice choice;
/* CIF ENDTEXT */
/* CIF START (428, 223), (100, 45) */
/* CIF PROCEDURE (727, 175), (106, 35) */
PROCEDURE emptyproc;
ENDPROCEDURE;
/* CIF START (438, 223), (80, 36) */
START;
/* CIF DECISION (428, 283), (99, 50) */
DECISION 'informal';
/* CIF ANSWER (398, 353), (70, 23) */
/* CIF DECISION (428, 274), (99, 50) */
DECISION 'informal'
/* CIF COMMENT (547, 281), (179, 53) */
COMMENT 'Informal decision -
check that it is ignored
by the code generator';
/* CIF ANSWER (398, 344), (70, 33) */
('a'):
/* CIF ANSWER (488, 353), (70, 33) */
/* CIF ANSWER (488, 344), (70, 33) */
('2'):
ENDDECISION;
/* CIF TASK (366, 401), (223, 38) */
/* CIF TASK (366, 392), (223, 38) */
TASK seqboolean := {true, false},
seqboolean := not {true, false};
/* CIF TASK (396, 454), (164, 53) */
/* CIF TASK (396, 445), (164, 53) */
TASK for x in seqen:
call writeln(num(x));
endfor;
/* CIF TASK (396, 522), (164, 53) */
/* CIF TASK (396, 513), (164, 53) */
TASK for x in seqen2:
call writeln(num(x));
endfor;
/* CIF TASK (397, 590), (162, 53) */
/* CIF TASK (397, 581), (162, 53) */
TASK for x in seqboolean:
call writeln(x);
endfor
/* CIF COMMENT (579, 599), (168, 38) */
/* CIF COMMENT (579, 590), (168, 38) */
COMMENT 'FOR with a basic type';
/* CIF TASK (367, 658), (222, 35) */
/* CIF TASK (367, 649), (222, 35) */
TASK seqboolean := not seqboolean
/* CIF COMMENT (609, 658), (279, 35) */
/* CIF COMMENT (609, 649), (279, 35) */
COMMENT 'check NOT on a SEQUENCE of BOOLEAN';
/* CIF TASK (397, 708), (162, 53) */
/* CIF TASK (397, 699), (162, 53) */
TASK for x in seqboolean:
call writeln(x);
endfor;
/* CIF TASK (415, 776), (126, 38) */
/* CIF TASK (415, 767), (126, 38) */
TASK fixed := 'hello';
/* CIF TASK (403, 829), (149, 35) */
/* CIF TASK (403, 820), (149, 35) */
TASK variable := 'HELLO';
/* CIF PROCEDURECALL (390, 879), (176, 35) */
/* CIF PROCEDURECALL (390, 870), (176, 35) */
CALL writeln(variable // '!!!');
/* CIF PROCEDURECALL (342, 929), (272, 35) */
/* CIF PROCEDURECALL (342, 920), (272, 35) */
CALL writeln(variable // variable // variable);
/* CIF TASK (432, 979), (91, 35) */
/* CIF TASK (432, 970), (91, 35) */
TASK seq := {1};
/* CIF TASK (401, 1029), (153, 35) */
/* CIF TASK (401, 1020), (153, 35) */
TASK seq := {1} // {2} // {3};
/* CIF TASK (392, 1079), (172, 35) */
/* CIF TASK (392, 1070), (172, 35) */
TASK seq := seq // {2} // {1};
/* CIF DECISION (443, 1129), (70, 50) */
/* CIF DECISION (443, 1120), (70, 50) */
DECISION any;
/* CIF ANSWER (398, 1199), (70, 23) */
/* CIF ANSWER (398, 1190), (70, 23) */
('a'):
/* CIF ANSWER (488, 1199), (70, 23) */
/* CIF ANSWER (488, 1190), (70, 23) */
('b'):
ENDDECISION;
/* CIF DECISION (433, 1237), (89, 50) */
/* CIF DECISION (433, 1228), (89, 50) */
DECISION myenum
/* CIF COMMENT (542, 1244), (183, 35) */
/* CIF COMMENT (542, 1235), (183, 35) */
COMMENT 'Check case insensitivity';
/* CIF ANSWER (250, 1307), (70, 23) */
/* CIF ANSWER (250, 1298), (70, 23) */
(a):
/* CIF ANSWER (330, 1307), (70, 23) */
/* CIF ANSWER (330, 1298), (70, 23) */
(B):
/* CIF ANSWER (410, 1307), (70, 23) */
/* CIF ANSWER (410, 1298), (70, 23) */
(c):
/* CIF ANSWER (488, 1307), (70, 23) */
/* CIF ANSWER (488, 1298), (70, 23) */
(d):
/* CIF ANSWER (576, 1307), (70, 23) */
/* CIF ANSWER (576, 1298), (70, 23) */
(Ee):
ENDDECISION;
/* CIF DECISION (409, 1345), (138, 50) */
/* CIF DECISION (409, 1336), (138, 50) */
DECISION present(choice)
/* CIF COMMENT (566, 1352), (183, 35) */
/* CIF COMMENT (566, 1343), (183, 35) */
COMMENT 'Check case insensitivity';
/* CIF ANSWER (361, 1415), (70, 23) */
/* CIF ANSWER (361, 1406), (70, 23) */
(cde2):
/* CIF ANSWER (532, 1415), (70, 23) */
/* CIF ANSWER (532, 1406), (70, 23) */
ELSE:
ENDDECISION;
/* CIF NEXTSTATE (419, 1453), (116, 33) */
/* CIF NEXTSTATE (419, 1444), (116, 33) */
NEXTSTATE Wait_for_GUI;
/* CIF STATE (423, 163), (118, 50) */
/* CIF STATE (424, 163), (116, 33) */
STATE Wait_for_GUI;
ENDSTATE;
ENDPROCESS orchestrator;
\ No newline at end of file
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