Xtext -> Xcore -> Xtext [message #1350708] |
Mon, 12 May 2014 19:54 |
Andrew Clark Messages: 23 Registered: June 2010 |
Junior Member |
|
|
I currently have 2 xtext projects 'foo' and 'bar', where bar model instances reference foo model instances.
I would now like to define *some* of the meta model externally. There is a reason I don't wish to define the entire meta model in xcore, but I won't go into it here.
So I am trying to use xcore defined meta models working together together with 2 xtext meta models. And I cannot get it to work!
ie.
Foo : xtext : defines a grammar and has an inferred model
FooCore : xcore : defines classes that reference Foo objects.
Bar : xtext : defines a grammar and has an inferred model , but uses FooCore defined classes.
(examples of the meta models are at the end of this post)
I get "Cannot find compatible feature fooDef in sealed EClass FooClass from imported package FooCore: The existing reference 'fooDef' has an incompatible type 'FooDef'. The expected type is 'FooDef'."
Is this possible or have I fundamentally misunderstood how this works?
Any help gratefully accepted, I tried to attach the Eclipse example projects but the attachments don't appear (no error). I can provide them if it helps.
I am working with the latest version of Kepler with Xtext 2.5 and Xcore 1.1
E.g. of the meta models.
Foo
"grammar org.xtext.example.foo.Foo with org.eclipse.xtext.common.Terminals
generate foo "http://www.xtext.org/example/foo/Foo"
Model:
foos+=FooDef*;
FooDef:
'Hello' name=ID '!';
"
FooCore
"
package FooCore
import org.xtext.example.foo.foo.FooDef
enum FooEnum {
one two three
}
class FooClass {
String name
contains FooDef fooDef
}
"
Bar
"
grammar org.xtext.example.bar.Bar with org.eclipse.xtext.common.Terminals
import "FooCore"
import "http://www.xtext.org/example/foo/Foo" as Foo
generate bar "http://www.xtext.org/example/bar/Bar"
BarModel:
barClasses+=BarClass*
;
BarClass returns FooClass :
'name' name=STRING
'foo' fooDef=[Foo::FooDef]
;
"
[Updated on: Mon, 12 May 2014 20:05] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03328 seconds