Commit 11252539 authored by Maxime Perrotin's avatar Maxime Perrotin

Complete support of local choice determinants

parent 71e0e3b1
......@@ -691,11 +691,15 @@ def check_call(name, params, context):
})
elif name == 'present':
return type('Present', (object,), {
'kind': 'ChoiceEnumeratedType',
'EnumValues': param_btys[0].Children
})
# now there is a proper type defined for choice selectors
sort = type_name (p.exprType) + "-selection"
return types()[sort].type
# return type('Present', (object,), {
# 'kind': 'ChoiceEnumeratedType',
# 'EnumValues': param_btys[0].Children
# })
#
elif name == 'round':
return type('Round', (REAL,), {
'Min': str(round(float(param_btys[0].Min))),
......@@ -2774,7 +2778,7 @@ def syntype(root, ta_ast, context):
"kind": reftype + "Type"
})
types[str(newtypename)] = newtype
types()[str(newtypename)] = newtype
LOG.debug("Found new SYNTYPE " + newtypename)
return errors, warnings
......@@ -2794,19 +2798,19 @@ def newtype(root, ta_ast, context):
if len(root.children) < 2:
warnings.append('Use newtype definitions for arrays and records only')
newtype.kind = "BooleanType"
types[str(newtypename)] = newtype
types()[str(newtypename)] = newtype
LOG.debug("Boolean newtype " + newtypename)
elif (root.getChild(1).type == lexer.ARRAY):
newtype.kind = "SequenceOfType"
newtype.type = get_array_type(root.getChild(1))
newtype.Min = "Min"
newtype.Max = "Max"
types[str(newtypename)] = newtype
types()[str(newtypename)] = newtype
LOG.debug("Found new ARRAY type " + newtypename)
elif (root.getChild(1).type == lexer.STRUCT):
newtype.kind = "SequenceType"
newtype.Children = get_struct_children(root.getChild(1))
types[str(newtypename)] = newtype
types()[str(newtypename)] = newtype
LOG.debug("Found new STRUCT type " + newtypename)
else:
warnings.append(
......
......@@ -24,19 +24,30 @@ system toto;
/* CIF ENDTEXT */
/* CIF START (240, 89), (70, 35) */
START;
/* CIF decision (222, 144), (106, 50) */
/* CIF task (160, 144), (229, 35) */
task choice_selectors := present(val);
/* CIF decision (222, 194), (106, 50) */
decision present (val);
/* CIF ANSWER (195, 214), (70, 24) */
/* CIF ANSWER (195, 264), (70, 24) */
(foo):
/* CIF ANSWER (285, 214), (70, 24) */
/* CIF ANSWER (285, 264), (70, 24) */
(bar):
enddecision;
/* CIF decision (222, 253), (106, 50) */
/* CIF decision (222, 303), (106, 50) */
decision present (val);
/* CIF ANSWER (241, 323), (70, 24) */
/* CIF ANSWER (166, 373), (129, 24) */
(choice_selectors):
/* CIF ANSWER (315, 373), (70, 24) */
else:
enddecision;
/* CIF NEXTSTATE (243, 362), (64, 35) */
/* CIF decision (210, 412), (129, 50) */
decision choice_selectors;
/* CIF ANSWER (223, 482), (103, 24) */
(present(val)):
/* CIF ANSWER (346, 482), (70, 24) */
else:
enddecision;
/* CIF NEXTSTATE (243, 521), (64, 35) */
NEXTSTATE hop;
/* CIF state (528, 360), (70, 35) */
state hop;
......
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