Re: Creating common interface [message #844028] |
Fri, 13 April 2012 16:01 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Andrew,
no, there is no other way to do that in your grammar. You should
consider to import the ePackage and maintain it manually.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 12.04.12 20:57, schrieb Andrew Gacek:
> 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
|
|
|
Powered by
FUDForum. Page generated in 0.03069 seconds