|Import And Scoping [message #1009014]
||Thu, 14 February 2013 04:51
| Girish Kumar
Registered: May 2011
I got a scenario, which i feel its a quite a generic feature, that xtext should provide.
A.mydsl has some types defined.
B.mydsl extends A.mydsl using importuri feature(we can say it is nothing but include)
So i am able to get to use the types that are defined in A.mydsl and B.mydsl in B.mydsl.
This is perfect as expected.
Now lets Assume, we have C.mydsl extends B.mydsl , But here i get to use types that are defined in B.mydsl and C.mydsl. I am not getting the types that are defined in A.mydsl.
Is there a way that we can achieve without adding the extra import.
Girish Kumar V
|Re: Import And Scoping [message #1009084 is a reply to message #1009078]
||Thu, 14 February 2013 06:58
| Alexander Nittka
Registered: July 2009
The comparison with java does not work out!|
a) not the file B.java extends the the file A.java, but the class B defined in B.java extends the class A in A.java
b) you don't use an import mechanism in java, but qualified names. The imports are only used to allow short names instead of the fully qualified names.
c) getABC() can be used in C because the scoping walks up the type hierarchy.
a) and b) is exactly what Xtext's qualified name fragment does for you. Resources (model files) export elements under a qualified name, other resources can reference these elements without explicitly having to import the containing files (as needed with the URI import).
c) you'll have to implement yourself using scoping because Xtext does not attach any meaning to a reference defined in the grammar.
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to firstname.lastname@example.org
Powered by FUDForum
. Page generated in 0.01972 seconds