If I have the following grammar:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
WithX:
A | B | C;
A:
"a" x=INT y=INT;
B:
"b" x=INT y=INT;
C:
"c" x=INT;
Then Xtext will generate the following Ecore model with a nice super class to factorize x:
However, if I add a rule to the grammar to also factorize y:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
WithX:
A | B | C;
WithY:
A | B ;
A:
"a" x=INT y=INT;
B:
"b" x=INT y=INT;
C:
"c" x=INT;
Then the generated Ecore Model does not factorize any feature anymore:
Is there any wait to obtain x in WithX and y in WithY?


