Xtext-Ecore problem with cross-reference and abstraction/specialization [message #1036590] |
Mon, 08 April 2013 11:25  |
Eclipse User |
|
|
|
Hi all,
I have a project were I defined three meta-models based on EMF.
In particular the third model has cross-references to the first two (i.e. some of the classes defined in the third model (C) contains references to objects of types defined in the first two (A and B)).
For the models A and B I've implemented a graphical representation with GMF.
For the model C I'm actually using the tree-editor provided by EMF.
With that Editor I'm able to cross-referencing entities defined in the A and B by importing them by means of the command "load resources".
I would like to implement a textual DSL for the model C and I thought to use XText.
I have two problems:
1) How can I cross-reference an object defined in A or B which are defined with my GMF editors?
In the grammar I used the syntax 'xyz' zyx=[model_alias::xyz|STRING]. However when I start the Xtext Editor I don't find an analogue of the EMF command "load resource" which allows me to reference the field "xyz" to one of the objects defined in A or B. How can I implement it?
2) Actually the model C is made of C1, C2, C3. C1 defines some abstract concepts which are specialized in C2 and C3. For these concept I wrote the rules (the rules also shows the reference to objects of the other models [problem 1]):
AbstractElement returns model_C1::AbstractElement :
ConcreteElementA | ConcreteElementB
;
ConcreteElementA returns model_C2::ConcreteElementA:
xyz+=[model_A::Xyz] ("," xyz+=[model_A::Xyz])
;
ConcreteElementA returns model_C3::ConcreteElementB:
xyz+=[model_A::Xyz] ("," xyz+=[model_A::Xyz])
;
The compilation here returns the error:
warning(200): ../myDSL/src-gen/myDSL/parser/antlr/internal/InternalResolutionDSL.g:295:1: Decision can match input such as "RULE_ID ',' RULE_ID" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
error(201): ../myDSL/src-gen/myDSL/parser/antlr/internal/InternalResolutionDSL.g:295:1: The following alternatives can never be matched: 2
When I remove the string "| ConcreteElementB" from the rules "AbstractElement" I'm able to compile without erros. How can I fix the second problem?
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06355 seconds