Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Overriding Rules - Erroneos Generated Interfaces
Overriding Rules - Erroneos Generated Interfaces [message #1802671] Wed, 13 February 2019 13:16
Eclipse UserFriend
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
Previous Topic:Usage of and(&) operator in grammar rule
Next Topic:XText 2.16 looking for XBase lib 2.10
Goto Forum:
  


Current Time: Sat Jun 14 01:45:02 EDT 2025

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

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

Back to the top