Hi,
I have a problem regarding grammar mixins and overriding productions in it.
I have the following base grammar:
grammar org.xtext.example.mydsl.SimpleAbstracts with org.eclipse.xtext.common.Terminals
generate simpleAbstracts "NoLinksAllowed"
Model : abstractProds+=AbstractProd*;
FirstImpl : "first" name=ID;
SecondImpl : "second" name=ID;
AbstractProd : firstImpl=FirstImpl | secondImpl=SecondImpl;
and the super grammar:
grammar org.xtext.example.mydsl.ComplexAbstracts with org.xtext.example.mydsl.SimpleAbstracts
generate complexAbstracts "NoLinksAllowed2"
@Override
Model : abstractProds+=AbstractProd* ;
ThirdImpl: "third" name=ID ;
@Override
AbstractProd : firstImpl=FirstImpl | secondImpl=SecondImpl | thirdImpl=ThirdImpl;
The problem what I now have, is that I cannot access the ThirdImpl, with the error model.getAbstractProds.get(0).getThirdImpl() does not exist as method.
Here is the problem:
/**
* generated by Xtext 2.16.0
*/
package org.xtext.example.mydsl.complexAbstracts;
/**
*...
*/
public interface Model extends org.xtext.example.mydsl.simpleAbstracts.Model
{
} // Model
So apparently, the Interfaces are not compatible, which also results that I am not able to parse models.
What I would expect is that the org.xtext.example.mydsl.complexAbstracts.Model would override the getAbstractProds() method of its super class. Naturally, the Impl class is aligned.
Is there a mistake in my approach. Should this work?
Best Regards,
Johannes Kästle