Closed seidewitz closed 7 months ago
@himi I don't think this will have any effect on the visualization code, but I thought you might want to take a look at it anyway.
@seidewitz, thank you. At least I'll check how it works with the current visualizer.
According to the KerML Specification, a “function operation expression” of the form
x -> f(y, z, ...)
should be parsed as a regularInvocationExpression
, equivalent tof(x, y, z, ...)
. However, the implementation had been parsing this as anOperatorExpression
, but with no value for theoperator
. This was both incorrect per the grammar in the specification, and it violated the mandatoryoperator
property. This PR revises the parsing of function operation expressions so they are properly parsed asInvocationExpressions
but notOperatorExpressions
.Background
In the specification grammar, the syntax for function operation expressions is given by the production:
However, since a
FunctionOperationExpression
is one of the alternatives ofPrimaryExpressionMember
, this production is left recursive and cannot be directly handled by the Xtext parser. Xtext provides tree rewrite actions to allow such left-recursive syntax to be implemented. To make it tractable to use this tree rewrite actions for the KerML expression grammar, a special non-normativeoperand
feature was implemented forOperatorExpressions
, allowing an operandExpression
to be directly inserted into the parse tree without having to explicitly create aFeatureMembership
for it in the grammar. This mechanism was also being used to parse function invocation expressions, even though they are not actuallyOperatorExpressions
.Resolution
CustomUML2EcoreConverter
in theorg.omg.sysml.uml.ecore.importer
project is updated to insert theoperand
feature into the EClassInvocationExpression
, rather thanOperatorExpression
, in the generated Ecore metamodel.operand
is moved fromOperatorExpressionImpl
toInvocationExpressionImpl
.PrimaryExpression
in the grammarKerMLExpression.kerml
has been updated so that function operation expressions are correctly parsed asInvocationExpressions
but notOperatorExpressions
: