Unify IfFunction and IfExpression in the grammar
Currently, we have two rules (and therefore two metamodel classes) for the builtins if-function and if-expression:
IfExpression:
true_ = IfExpressionParameter
'if' expr = BooleanExpression
'else' false_ = IfExpressionParameter
;
IfFunction:
'if' '('
expr = BooleanExpression ','
true_ = Parameter ','
false_ = Parameter
')'
;
It should be possible to unify them syntactically in one rule because they are semantically equivalent (the latter leads to identical IfFunction
and IfExpression
metamodel classes). Something like this should work:
IfFunction:
(
true_ = IfExpressionParameter
'if' expr = BooleanExpression
'else' false_ = IfExpressionParameter
) |
(
'if' '('
expr = BooleanExpression ','
true_ = Parameter ','
false_ = Parameter
')'
)
;
Also it should be possible to eliminate the IfExpressionParameter
in favor of Parameter
.