[Xtext 1] How to serialize inter-model cross references, or, how to automatically generate input sta [message #813492] |
Mon, 05 March 2012 10:34 |
|
Hi all,
I have a problem when serializing a model containing inter-model
cross-references (only called cross-references in the following). The
model is created programmatically and it contains cross-references,
which is no problem as long as the model is stored as EMF/ecore model in
memory. However, when saving, aka serializing, the model, the
cross-references causes problems. XMI does not use the concept of
"import"-statements, however, my language uses this concept. That is,
an item X can be cross-referenced only, if it's scope/namespace is made
available via some import statement. Although I use a slightly different
mechanism, the problem should be similar to the importURI-feature of Xtext.
Since the code creating the model doesn't know anything about the
serializiation (from the generator point of view, the model is only an
ecore model), it cannot create import statements. Scope providers work
the other way round, that is, they return an EObject for a given name.
What I need is some mechanism for automatically adding import-like
statements, when a cross-reference requires that statement. Is this
possible, or do I have to extend my grammar in order to support fully
qualified names? And how do I distinguish between simple names and fully
qualified names when serializing a model?
Cheers,
Jens
|
|
|
Powered by
FUDForum. Page generated in 0.02893 seconds