Grammar mixin [message #1765596] |
Mon, 12 June 2017 16:33 |
Carsten Wrobel Messages: 9 Registered: May 2017 |
Junior Member |
|
|
Is it possible to combine 2 different meta models - defined in 2 different ecore files and mix them together in a common grammar?
Example grammar:
Grammar org.xtext.urdf.Dsl with org.eclipse.xtext.common.Terminals
Import "http://www.eclipse.org/emf/2002/Ecore" as ecore
Import "http://www.example.org/uRDF" as uRDF
Import "http://www.xtext.org/example/expressions/ExprDsl" as expr
Robot returns uRDF :: Robot:
'Robot' name = ID
(Link + = link | joint + = joint) *
addition+=Addition*
;
The type Robot relates to the uRDF model and Addition relates to the expression model. Since Addition is not included as a feature in Robot, the reference fails.
The expression model is independent of uRDF, but not vice versa. In order to get the references in place, the expression model can be built into uRDF, but we would like to keep the models separate for clarity. Therefore, the question of it is possible to connect the types from different ecore files in a grammar.
It seems like multiple inheritance (eg.-> grammar urdf with super, expr, sub1, sub2) maybe could solve this, and from earlier posts I saw that xtext didn't support that. Any update to that?
Thanks
|
|
|
|
Powered by
FUDForum. Page generated in 0.03637 seconds