Commit 9e5fc408 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Merge branch 'master' of https://github.com/dbrabera/opengeode

parents a51cbda5 643f2bd4
*.pyc
*.autosave
tests/**/*.ads
tests/**/*.adb
tests/**/*.ali
tests/**/*.o
tests/**/*.idx
tests/**/*.wrn
tests/**/*.gpr
tests/**/*.sh
tests/**/*.cfg
tests/**/result
tests/**/testcase
tests/**/result
antlr-3.1.3.tar.bz2
antlr-3.1.3/
tests/**/*.stg
......@@ -1183,17 +1183,21 @@ def _mantissa_base_exp(primary):
return [], u'', []
@expression.register(ogAST.PrimIfThenElse)
def _if_then_else(ifThenElse):
''' Return string and statements for ternary operator '''
resType = ifThenElse.exprType
@expression.register(ogAST.PrimConditional)
def _conditional(cond):
''' Return string and statements for conditional expressions '''
resType = cond.exprType
stmts = []
if resType.kind.startswith('Integer'):
if resType.kind in ('IntegerType', 'Integer32Type'):
tmp_type = 'Asn1Int'
elif resType.kind == 'StandardStringType':
print ifThenElse.value['then'].value
then_str = ifThenElse.value['then'].value.replace("'", '"')
else_str = ifThenElse.value['else'].value.replace("'", '"')
elif resType.kind == 'RealType':
tmp_type = 'Asn1Real'
elif resType.kind == 'BooleanType':
tmp_type = 'Boolean'
elif resType.kind == 'StringType':
then_str = cond.value['then'].value.replace("'", '"')
else_str = cond.value['else'].value.replace("'", '"')
lens = [len(then_str), len(else_str)]
tmp_type = 'String(1 .. {})'.format(max(lens) - 2)
# Ada require fixed-length strings, adjust with spaces
......@@ -1203,29 +1207,30 @@ def _if_then_else(ifThenElse):
else_str = else_str[0:-1] + ' ' * (lens[0] - lens[1]) + '"'
else:
tmp_type = 'asn1Scc' + resType.ReferencedTypeName.replace('-', '_')
local_decl = ['tmp{idx} : {tmpType};'.format(
idx=ifThenElse.value['tmpVar'],
idx=cond.value['tmpVar'],
tmpType=tmp_type)]
if_stmts, if_str, if_local = expression(ifThenElse.value['if'])
if_stmts, if_str, if_local = expression(cond.value['if'])
stmts.extend(if_stmts)
local_decl.extend(if_local)
if resType.kind != 'StandardStringType':
then_stmts, then_str, then_local = expression(ifThenElse.value['then'])
else_stmts, else_str, else_local = expression(ifThenElse.value['else'])
if resType.kind != 'StringType':
then_stmts, then_str, then_local = expression(cond.value['then'])
else_stmts, else_str, else_local = expression(cond.value['else'])
stmts.extend(then_stmts)
stmts.extend(else_stmts)
local_decl.extend(then_local)
local_decl.extend(else_local)
stmts.append(u'if {if_str} then'.format(if_str=if_str))
stmts.append(u'tmp{idx} := {then_str};'.format(
idx=ifThenElse.value['tmpVar'],
idx=cond.value['tmpVar'],
then_str=then_str))
stmts.append('else')
stmts.append(u'tmp{idx} := {else_str};'.format(
idx=ifThenElse.value['tmpVar'],
idx=cond.value['tmpVar'],
else_str=else_str))
stmts.append('end if;')
ada_string = u'tmp{idx}'.format(idx=ifThenElse.value['tmpVar'])
ada_string = u'tmp{idx}'.format(idx=cond.value['tmpVar'])
return stmts, unicode(ada_string), local_decl
......
......@@ -387,9 +387,9 @@ def _rename_path(ast, from_name, to_name):
ast.value[0] = to_name
@rename_everything.register(ogAST.PrimIfThenElse)
@rename_everything.register(ogAST.PrimConditional)
def _rename_ifhthenelse(ast, from_name, to_name):
''' Rename expressions in If-Then-Else-Fi construct '''
''' Rename expressions in Conditional expression construct '''
for expr in ('if', 'then', 'else'):
rename_everything(ast.value[expr], from_name, to_name)
......
......@@ -248,8 +248,8 @@ def _mantissa_base_exp(primary):
pass
@expression.register(ogAST.PrimIfThenElse)
def _if_then_else(ifThenElse):
@expression.register(ogAST.PrimConditional)
def _conditional(cond):
''' Return string and statements for ternary operator '''
pass
......
......@@ -27,5 +27,6 @@ publish: install
python setup.py sdist upload
clean:
make -C tests/regression clean
find . -name '*~' | xargs rm -f
find . -name '*.o' | xargs rm -f
......@@ -232,7 +232,7 @@ class PrimOctetStringLiteral(Primary):
pass
class PrimIfThenElse(Primary):
class PrimConditional(Primary):
''' value is a dictionnary:
{ 'if': Expression, 'then': Expression,
'else': Expression, 'tmpVar': integer}
......
......@@ -28,8 +28,6 @@ __author__ = 'Maxime Perrotin'
import sys
import os
import re
import fnmatch
import logging
import traceback
from itertools import chain, permutations, combinations
......@@ -68,7 +66,6 @@ EXPR_NODE = {
lexer.NOT: ogAST.ExprNot,
lexer.NEG: ogAST.ExprNeg,
lexer.PRIMARY: ogAST.Primary,
lexer.IFTHENELSE: ogAST.PrimIfThenElse,
}
# Insert current path in the search list for importing modules
......@@ -394,11 +391,7 @@ def fix_special_operators(op_name, expr_list, context):
for each in (INTEGER, REAL, BOOLEAN, RAWSTRING, OCTETSTRING):
try:
check_type_compatibility(param, each, context)
if each is OCTETSTRING and isinstance(param,
ogAST.PrimIfThenElse):
param.exprType = param.value['then'].exprType
else:
param.exprType = each
param.exprType = each
break
except TypeError:
continue
......@@ -551,28 +544,15 @@ def check_type_compatibility(primary, typeRef, context):
'" not in this enumeration: ' +
str(actual_type.EnumValues.keys()))
raise TypeError(err)
elif isinstance(primary, ogAST.PrimIfThenElse):
# check that IF expr returns BOOL, and that Then and Else expressions
# are compatible with actual_type
if_expr = primary.value['if']
elif isinstance(primary, ogAST.PrimConditional):
then_expr = primary.value['then']
else_expr = primary.value['else']
if if_expr.exprType.kind != 'BooleanType':
raise TypeError('IF expression does not return a boolean')
else:
for expr in (then_expr, else_expr):
if expr.is_raw:
check_type_compatibility(expr, typeRef, context)
# compare the types for semantic equivalence:
else:
if expr.exprType is UNKNOWN_TYPE:
# If it was not resolved before, it must be a variable
# this can happen in the context of a special operator
# (write), where at no point before where the type
# could be compared to another type
expr.exprType = find_variable(expr.value[0], context)
compare_types(expr.exprType, typeRef)
for expr in (then_expr, else_expr):
if expr.is_raw:
check_type_compatibility(expr, typeRef, context)
return
elif isinstance(primary, ogAST.PrimVariable):
try:
compare_types(primary.exprType, typeRef)
......@@ -634,7 +614,7 @@ def check_type_compatibility(primary, typeRef, context):
# Compare the types for semantic equivalence
try:
compare_types(
primary.value[ufield].exprType, fd_data.type)
primary.value[ufield].exprType, fd_data.type)
except TypeError as err:
raise TypeError('Field ' + ufield +
' is not of the proper type, i.e. ' +
......@@ -871,7 +851,7 @@ def fix_expression_types(expr, context):
raise TypeError('Cannot resolve type of "{}"'
.format(unknown[0].inputString))
# In Sequence, Choice, SEQUENCE OF, and IfThenElse expressions,
# In Sequence, Choice and SEQUENCE OF expressions,
# we must fix missing inner types
# (due to similarities, the following should be refactored FIXME)
if isinstance(expr.right, ogAST.PrimSequence):
......@@ -913,7 +893,7 @@ def fix_expression_types(expr, context):
check_expr.right = expr.right.value['value']
fix_expression_types(check_expr, context)
expr.right.value['value'] = check_expr.right
elif isinstance(expr.right, ogAST.PrimIfThenElse):
elif isinstance(expr.right, ogAST.PrimConditional):
for det in ('then', 'else'):
# Recursively fix possibly missing types in the expression
check_expr = ogAST.ExprAssign()
......@@ -1040,8 +1020,8 @@ def expression(root, context):
return neg_expression(root, context)
elif root.type == lexer.PAREN:
return expression(root.children[0], context)
elif root.type == lexer.IFTHENELSE:
return if_then_else_expression(root, context)
elif root.type == lexer.CONDITIONAL:
return conditional_expression(root, context)
elif root.type == lexer.PRIMARY:
return primary(root.children[0], context)
elif root.type == lexer.CALL:
......@@ -1076,13 +1056,16 @@ def logic_expression(root, context):
errors.append(error(root, msg))
break
if bty.kind in ('BooleanType', 'BitStringType'):
if bty.kind == 'BooleanType':
continue
elif bty.kind == 'BitStringType' and bty.Min == bty.Max:
continue
elif bty.kind == 'SequenceOfType' and bty.type.kind == 'BooleanType':
elif bty.kind == 'SequenceOfType' and bty.type.kind == 'BooleanType'\
and bty.Min == bty.Max:
continue
else:
msg = 'Bitwise operators only work with Booleans, ' \
'SequenceOf Booleans or BitStrings'
'fixed size SequenceOf Booleans or fixed size BitStrings'
errors.append(error(root, msg))
break
......@@ -1260,11 +1243,11 @@ def neg_expression(root, context):
return expr, errors, warnings
def if_then_else_expression(root, context):
''' If Then Else expression analysis '''
def conditional_expression(root, context):
''' Conditional expression analysis '''
errors, warnings = [], []
expr = ogAST.PrimIfThenElse(
expr = ogAST.PrimConditional(
get_input_string(root),
root.getLine(),
root.getCharPositionInLine()
......@@ -1286,7 +1269,20 @@ def if_then_else_expression(root, context):
errors.extend(err)
warnings.extend(warn)
if find_basic_type(if_expr.exprType).kind != 'BooleanType':
msg = 'Conditions in conditional expressions must be of type Boolean'
errors.append(error(root, msg))
# TODO: Refactor this
try:
expr.left = then_expr
expr.right = else_expr
fix_expression_types(expr, context)
expr.exprType = then_expr.exprType
except (AttributeError, TypeError) as err:
if UNKNOWN_TYPE not in (then_expr.exprType, else_expr.exprType):
errors.append(error(root, str(err)))
expr.value = {
'if': if_expr,
'then': then_expr,
......@@ -1410,7 +1406,6 @@ def primary_call(root, context):
'Max': str(max(enum_values))
})
except AttributeError:
msg = 'Type Error, check the parameter'
errors.append(error(root, '"Num" parameter error'))
return node, errors, warnings
......@@ -1620,7 +1615,7 @@ def primary(root, context):
elif root.type == lexer.OCTSTR:
prim = ogAST.PrimOctetStringLiteral()
warnings.append(
warning(root, 'Octet string literal not supported yet'))
warning(root, 'Octet string literal not supported yet'))
else:
# TODO: return error message
raise NotImplementedError
......@@ -2582,9 +2577,9 @@ def state(root, parent, context):
else:
asterisk_input = inp
elif child.type == lexer.CONNECT:
comp_states = (comp.statename for comp in context.composite_states)
if asterisk_state or len(state_def.statelist) != 1 \
or (state_def.statelist[0].lower()
not in (comp.statename for comp in context.composite_states)):
or state_def.statelist[0].lower() not in comp_states:
errors.append('State {} is not a composite state and cannot '
'be followed by a connect statement'
.format(state_def.statelist[0]))
......@@ -3091,7 +3086,7 @@ def decision(root, parent, context):
qmin, qmax = int(float(q_basic.Min)), int(float(q_basic.Max))
a0_val = int(float(a0_basic.Min))
a1_val = int(float(a1_basic.Max))
if a0_val < qmin:
if a0_val < qmin:
warnings.append('Decision "{dec}": '
'Range [{a0} .. {qmin}] is unreachable'
.format(a0=a0_val, qmin=qmin - 1,
......
......@@ -33,6 +33,7 @@ tokens {
CLOSED_RANGE;
COMMENT;
COMPOSITE_STATE;
CONDITIONAL;
CONNECT;
CONNECTION;
CONSTANT;
......@@ -836,7 +837,7 @@ postfix_expression
primary_expression
: primary -> ^(PRIMARY primary)
| '(' expression ')' -> ^(PAREN expression)
| conditional_ground_expression
| conditional_expression
;
......@@ -966,31 +967,19 @@ operator_application
active_expression_list
: active_expression (',' expression_list)?;/* |
ground_expression ',' active_expression_list;*/ // Will not work (recursion)
/*
conditional_expression
: IF boolean_active_expression THEN consequence_expression ELSE alternative_expression FI |
IF boolean_expression THEN active_consequence_expression ELSE alternative_expression FI |
IF boolean_expression THEN consequence_expression ELSE active_alternative_expression FI;
*/
// Simpler version, the rest will is checked by semantic analysis
conditional_expression
: IF expression THEN expression ELSE expression FI;
//synonym : ID; // synonym_id | external_synonym;
external_synonym
: external_synonym_id;
conditional_ground_expression
conditional_expression
: IF ifexpr=expression
THEN thenexpr=expression
ELSE elseexpr=expression FI
-> ^(IFTHENELSE $ifexpr $thenexpr $elseexpr);
-> ^(CONDITIONAL $ifexpr $thenexpr $elseexpr);
expression_list
......
This diff is collapsed.
This diff is collapsed.
EXAMPLES=test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 test-substrings
EXAMPLES=test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 \
test11 test12 test-substrings test-expressions
coverage:
for v in $(EXAMPLES) ; do make -C $$v coverage && mv $$v/.coverage* . || exit 1 ; done ; coverage combine
for v in $(EXAMPLES) ; do make -C $$v coverage && mv $$v/.coverage* . \
|| exit 1 ; done ; coverage combine
clean:
for v in $(EXAMPLES); do make -C $$v clean ; done
all: test-ada
test-parse:
../../../opengeode.py basic.pr system_structure.pr --check
../../../opengeode.py expressions.pr system_structure.pr --check
test-ada:
../../../opengeode.py basic.pr system_structure.pr --check --toAda
../../../opengeode.py expressions.pr system_structure.pr --check --toAda
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc
gnatmake -c *.adb
gcc -c test_ada.c
gnatbind -n basic.ali
gnatlink test_ada.o basic.ali -lgnat -lm -o testcase
./testcase | diff expected -
gnatbind -n expressions.ali
gnatlink test_ada.o expressions.ali -lgnat -lm -o testcase
./testcase
clean:
rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner bin *.wrn *.gpr testcase
rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner \
bin *.wrn *.gpr testcase *.ll *.s dataview-uniq.c dataview-uniq.h real.c xer.c \
ber.c acn.c asn1crt.c asn1crt.h
TASTE-Dataview DEFINITIONS ::=
BEGIN
Boolean ::= BOOLEAN
Integer ::= INTEGER(-9223372036854775808..9223372036854775807)
Real ::= REAL (-100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0 .. 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0)
CharString ::= OCTET STRING (SIZE(0..100))
IntegerFixSeqof ::= SEQUENCE (SIZE(3)) OF Integer
IntegerVarSeqof ::= SEQUENCE (SIZE(0..100)) OF Integer
Seq ::= SEQUENCE {
i Integer,
b Boolean,
f Real,
s CharString
}
NestedSeq ::= SEQUENCE {
a SEQUENCE {
b SEQUENCE {
c SEQUENCE {
d Integer
}
}
}
}
END
/* CIF PROCESS (145, 158), (150, 75) */
PROCESS expressions;
/* CIF TEXT (358, 168), (303, 168) */
DCL i Integer;
DCL f Real;
DCL b Boolean;
DCL s CharString;
DCL fixSeqOf1 IntegerFixSeqof;
DCL fixSeqOf2 IntegerFixSeqof;
DCL varSeqOf1 IntegerVarSeqof;
DCL varSeqOf2 IntegerVarSeqof;
DCL seq Seq;
DCL nestedSeq NestedSeq;
/* CIF ENDTEXT */
/* CIF START (0, 0), (100, 50) */
START;
/* CIF NEXTSTATE (0, 65), (100, 50) */
NEXTSTATE Wait;
/* CIF STATE (0, 65), (100, 50) */
STATE Wait;
/* CIF INPUT (1, 135), (100, 50) */
INPUT run;
/* CIF TASK (-150, 200), (402, 35) */
TASK '------------------------------- Binary expressions -------------------------------';
/* CIF TASK (5, 250), (90, 35) */
TASK b := true;
/* CIF PROCEDURECALL (-75, 300), (253, 35) */
CALL assert(b and true, 'b and true');
/* CIF PROCEDURECALL (-75, 350), (253, 35) */
CALL assert(b or false, 'b or false');
/* CIF PROCEDURECALL (-75, 400), (253, 35) */
CALL assert(b xor false, 'b xor false');
/* CIF TASK (14, 450), (73, 35) */
TASK i := 10;
/* CIF PROCEDURECALL (-50, 500), (203, 35) */
CALL assert(i + 1 = 11, 'i + 1 = 11');
/* CIF PROCEDURECALL (-43, 550), (188, 35) */
CALL assert(i - 1 = 9, 'i - 1 = 9');
/* CIF PROCEDURECALL (-49, 600), (201, 35) */
CALL assert(i * 2 = 20, 'i * 2 = 20');
/* CIF PROCEDURECALL (-43, 650), (188, 35) */
CALL assert(i / 2 = 5, 'i / 2 = 5');
/* CIF PROCEDURECALL (-64, 700), (230, 35) */
CALL assert(i mod 2 = 0, 'i mod 2 = 0');
/* CIF PROCEDURECALL (-61, 750), (224, 35) */
CALL assert(i rem 2 = 0, 'i rem 2 = 0');
/* CIF PROCEDURECALL (-29, 800), (161, 35) */
CALL assert(i < 20, 'i < 20');
/* CIF PROCEDURECALL (-37, 850), (176, 35) */
CALL assert(i <= 10, 'i <= 10');
/* CIF PROCEDURECALL (-37, 900), (176, 35) */
CALL assert(i >= 10, 'i >= 10');
/* CIF PROCEDURECALL (-37, 950), (176, 35) */
CALL assert(i > 5, 'i > 5');
/* CIF PROCEDURECALL (-29, 1000), (161, 35) */
CALL assert(i = 10, 'i = 10');
/* CIF PROCEDURECALL (-27, 1050), (156, 35) */
CALL assert(i /= 9, 'i /= 9');
/* CIF TASK (8, 1100), (85, 35) */
TASK f := 10.0;
/* CIF PROCEDURECALL (-74, 1150), (250, 35) */
CALL assert(f + 1.0 = 11.0, 'f + 1.0 = 11.0');
/* CIF PROCEDURECALL (-63, 1200), (228, 35) */
CALL assert(f - 1.0 = 9.0, 'f - 1.0 = 9.0');
/* CIF PROCEDURECALL (-73, 1250), (248, 35) */
CALL assert(f * 2.0 = 20.0, 'f * 2.0 = 20.0');
/* CIF PROCEDURECALL (-64, 1300), (230, 35) */
CALL assert(f / 2.0 = 5.0, 'f / 2.0 = 5.0');
/* CIF PROCEDURECALL (-49, 1350), (201, 35) */
CALL assert(f < 20.0, 'f < 20.0');
/* CIF PROCEDURECALL (-49, 1400), (201, 35) */
CALL assert(f <= 10.0, 'f <= 10.0');
/* CIF PROCEDURECALL (-49, 1450), (201, 35) */
CALL assert(f >= 10.0, 'f >= 10.0');
/* CIF PROCEDURECALL (-49, 1500), (201, 35) */
CALL assert(f > 5.0, 'f > 5.0');
/* CIF PROCEDURECALL (-42, 1550), (186, 35) */
CALL assert(f = 10.0, 'f = 10.0');
/* CIF PROCEDURECALL (-44, 1600), (191, 35) */
CALL assert(f /= 9.0, 'f /= 9.0');
/* CIF TASK (-29, 1650), (160, 35) */
TASK fixSeqOf1 := {1, 2, 3};
/* CIF TASK (-29, 1700), (160, 35) */
TASK fixSeqOf2 := {3, 4, 5};
/* CIF PROCEDURECALL (-82, 1750), (267, 35) */
CALL assert(2 in fixSeqOf1, '2 in fixSeqOf1');
/* CIF PROCEDURECALL (-112, 1800), (326, 35) */
CALL assert(not(4 in fixSeqOf1), 'not(4 in fixSeqOf1)');
/* CIF PROCEDURECALL (-137, 1850), (377, 35) */
CALL assert(fixSeqOf1 /= fixSeqOf2, 'fixSeqOf1 /= fixSeqOf2');
/* CIF TASK (-29, 1900), (160, 35) */
TASK fixSeqOf2 := {1, 2, 3};
/* CIF PROCEDURECALL (-132, 1950), (367, 35) */
CALL assert(fixSeqOf1 = fixSeqOf2, 'fixSeqOf1 = fixSeqOf2');
/* CIF TASK (-31, 2000), (164, 35) */
TASK varSeqOf1 := {1, 2, 3};
/* CIF TASK (-31, 2050), (164, 35) */
TASK varSeqOf2 := {4, 5, 6};
/* CIF PROCEDURECALL (-86, 2100), (274, 35) */
CALL assert(2 in varSeqOf1, '2 in varSeqOf1');
/* CIF PROCEDURECALL (-115, 2150), (333, 35) */
CALL assert(not(4 in varSeqOf1), 'not(4 in varSeqOf1)');
/* CIF PROCEDURECALL (-144, 2200), (391, 35) */
CALL assert(varSeqOf1 /= varSeqOf2, 'varSeqOf1 /= varSeqOf2');
/* CIF TASK (-80, 2250), (263, 35) */
TASK varSeqOf1 := varSeqOf1 // varSeqOf2;
/* CIF PROCEDURECALL (-130, 2300), (363, 35) */
CALL assert(length(varSeqOf1) = 6, 'lenght(varSeqOf1) = 6');
/* CIF PROCEDURECALL (-99, 2350), (300, 35) */
CALL assert(varSeqOf1(3) = 4, 'varSeqOf1(3) = 4');
/* CIF PROCEDURECALL (-99, 2400), (300, 35) */
CALL assert(varSeqOf1(4) = 5, 'varSeqOf1(4) = 5');
/* CIF PROCEDURECALL (-99, 2450), (300, 35) */
CALL assert(varSeqOf1(5) = 6, 'varSeqOf1(5) = 6');
/* CIF TASK (-32, 2500), (166, 35) */
TASK varSeqOf1 := {1, 2, 3};
/* CIF TASK (-31, 2550), (164, 35) */
TASK varSeqOf2 := {1, 2, 3};
/* CIF PROCEDURECALL (-139, 2600), (381, 35) */
CALL assert(varSeqOf1 = varSeqOf2, 'varSeqOf1 = varSeqOf2');
/* CIF TASK (-3, 2650), (108, 35) */
TASK s := 'HELLO';
/* CIF PROCEDURECALL (-191, 2700), (484, 35) */
CALL assert(s // s // s = 'HELLOHELLOHELLO', 's // s // s = "HELLOHELLOHELLO"');
/* CIF TASK (-148, 2750), (399, 35) */
TASK '------------------------------- Unary expressions -------------------------------';
/* CIF TASK (3, 2800), (95, 35) */
TASK b := false;
/* CIF PROCEDURECALL (-29, 2850), (160, 35) */
CALL assert(not b, 'not b');
/* CIF TASK (14, 2900), (73, 35) */
TASK i := 10;
/* CIF PROCEDURECALL (-37, 2950), (177, 35) */
CALL assert(-i = -10, '-i = -10');
/* CIF TASK (-151, 3000), (405, 35) */
TASK '------------------------------- Primary Expression -------------------------------';
/* CIF PROCEDURECALL (-84, 3050), (271, 35) */
CALL assert(((1 + 1) * 4) = 8, '((1 + 1) * 4) = 8');
/* CIF PROCEDURECALL (-157, 3100), (417, 35) */
CALL assert(if true then 1 else 2 fi = 1, 'if true then 1 else 2 fi = 1');
/* CIF PROCEDURECALL (-183, 3150), (468, 35) */
CALL assert(if false then 1.0 else 2.0 fi = 2.0, 'if false then 1.0 else 2.0 fi = 2.0');
/* CIF PROCEDURECALL (-475, 3200), (1052, 35) */
CALL assert(if false then false else (if true then (if false then false else true fi) else false fi) fi, 'if false then false else (if true then (if false then false else true fi) else false fi) fi');
/* CIF TASK (-183, 3250), (468, 35) */
TASK '------------------------------- Extended Primary Expressions -------------------------------';
/* CIF TASK (-30, 3300), (163, 35) */
TASK fixSeqOf1 := {2, 3, 4};
/* CIF PROCEDURECALL (-95, 3350), (293, 35) */
CALL assert(fixSeqOf1(1) = 3, 'fixSeqOf1(1) = 3');
/* CIF TASK (-31, 3400), (164, 35) */
TASK varSeqOf1 := {2, 3, 4};
/* CIF PROCEDURECALL (-99, 3450), (300, 35) */
CALL assert(varSeqOf1(1) = 3, 'varSeqOf1(1) = 3');
/* CIF TASK (-68, 3500), (239, 35) */
TASK seq := {i 1, b true, f 1.0, s 'HELLO'};
/* CIF PROCEDURECALL (-47, 3550), (196, 35) */
CALL assert(seq!i = 1, 'seq!i = 1');
/* CIF PROCEDURECALL (-69, 3600), (241, 35) */
CALL assert(seq!b = true, 'seq!b = true');
/* CIF PROCEDURECALL (-59, 3650), (221, 35) */
CALL assert(seq!f = 1.0, 'seq!f = 1.0');
/* CIF PROCEDURECALL (-93, 3700), (289, 35) */
CALL assert(seq!s = 'HELLO', 'seq!s = "HELLO"');
/* CIF TASK (-51, 3750), (204, 35) */
TASK nestedSeq := {a {b {c {d 9}}}};
/* CIF PROCEDURECALL (-126, 3800), (354, 35) */
CALL assert(nestedSeq!a!b!c!d = 9, 'nestedSeq!a!b!c!d = 9');
/* CIF NEXTSTATE (1, 3850), (100, 50) */
NEXTSTATE Wait;
ENDSTATE;
ENDPROCESS expressions;
\ No newline at end of file