Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Creating common interface
Creating common interface [message #842994] Thu, 12 April 2012 18:53 Go to next message
Andrew Gacek is currently offline Andrew GacekFriend
Messages: 32
Registered: October 2011
Member
I have an expression language that has both field and array access:

Index returns Expr:
  Atom ({FieldIndex.base=current} '.' field=ID |
        {ArrayIndex.base=current} '[' index=INT ']')*
;


This generates interfaces FieldIndex and ArrayIndex, both extending Expr, which have their own versions of set/getBase(). I am trying to find a way to get Xtext to generate an intermediate interface Index which extends Expr and contains set/getBase() and such that FieldIndex and ArrayIndex both extend Index. So far the best solution I've found is the following two fake productions:

Fake1 returns Expr: {Index} base=Expr;
Fake2 returns Index: {FieldIndex} | {ArrayIndex};


Is there a better way to do this?

Thanks,
Andrew
Re: Creating common interface [message #843117 is a reply to message #842994] Thu, 12 April 2012 19:33 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Guess it is time to switch to a manually maintained metamodel

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:How can I check feature assignment is ok?
Next Topic:Problem in parsing whitespace sensitive DSL
Goto Forum:
  


Current Time: Tue Apr 23 15:49:48 GMT 2024

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

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

Back to the top