Creating common interface [message #842994] |
Thu, 12 April 2012 14:53  |
Eclipse User |
|
|
|
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.03905 seconds