Xtext grammar rule composite

248 views Asked by At

Whats the difference between the following two rules?

This first implementation is working as expected:

Lane:
    '{' actions+=Element* '}';

So I can leave it empty or add any number of Elements.

Whereas the second one throws an exception:

Lane:
    '{' (actions+=Element+)? '}';

Stack trace:

Caused by: java.io.IOException: Generated EMF Model incomplete: Could not serialize EObject via backtracking.
Constraint: null actions+=Element null
Values: actions(2)
Semantic Object: ....->Lane
Context: Lane

Where has the multiplicity of Element in Constraint gone?

Constraint: null actions+=Element null
0

There are 0 answers