Reference elements from a different file [message #1314637] |
Fri, 25 April 2014 09:57  |
Eclipse User |
|
|
|
Hey,
I', pretty new to xtext and am trying to assemble my first real grammar so please excuse noobish questions, but i was unable to find a solution.
i have files like this:
package common;
type MyType : String {
property label "MyLabel";
}
and in a separate file:
package common;
structure MyStruct {
attribute myAttr : MyType;
attribute myFqnAttr : common.MyType;
}
Now i have a slight scoping problem. I made it that the second attribute works (qualified name used), however i have troubles getting the short version to run.
I have no real clue on how to do it, really. I have tried to delegate the scope calculation for the type reference to the top-level container, for which i calculate a qualified name equal to the package (so all file containing "package common;" have the same qualified name "common" (bad idea?)). Now if i delegate the scope calculation i get a scope that will contain all elements from the current file, but not from the first one, defining the actually requested element.
How the heck am i able to do something like this?? I found a 2009'ish blog about the "index", however none of the API seems to exist anymore...
(if that is of interest: the only actual modification to the pre-generated files, apart from my tries to get this to work is that qualified name calculation for top-level elements in each file. the qualified name for MyType will be prefixed by the package name of it's container (thus common.MyType now works)).
Thankful for any comment!
Thanks in advance, Markus
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05241 seconds