Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Overriding Rules - Erroneos Generated Interfaces
Overriding Rules - Erroneos Generated Interfaces [message #1802671] Wed, 13 February 2019 18:16
Johannes Kästle is currently offline Johannes KästleFriend
Messages: 1
Registered: February 2019
Junior Member

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"

Model : abstractProds+=AbstractProd* ;

ThirdImpl: "third" name=ID ;

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
Previous Topic:Broken Build when changing grammar with org.eclipse.xtext.xbase.Xbase
Next Topic:Xtext maven plugin language order
Goto Forum:

Current Time: Thu Jan 23 05:09:21 GMT 2020

Powered by FUDForum. Page generated in 0.01772 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top