|
Re: (Fully)?QualifiedName [message #898787 is a reply to message #898746] |
Fri, 27 July 2012 14:49 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
The QualifiedName is used to name things, and for expressing a reference
to a named item. It is the responsability of Scoping of presenting
eligible candidates for referencing existing elements, and the
responsibility of "Containers" to manage the overall visibility of
elements to scoping.
By default everything that has a "name" feature is exported and gets a
fully qualified name based on its containment. Containment comes in
different flavors - using OSGi/Java classpath, Eclipse project
depedencies, etc. (You configure how you want this to work in your
language - it is in the documentation).
Scoping has many possibilities, and documentation does not really
contain any recipes - but search this forum for pointers to blog posts
and examples on Scoping.
You also have to decide on if you want to use an import scheme (like
java) to prevent requirement on having a fully/semi qualified named
reference when there are ambiguities. I.e. if you reference using "a"
and when the code is written there is only one "a" but later there are
several "a" to chose from and none is closer to the other in scoping to
the current position. If your different "a"'s then have very long names,
you may not want to have to type "org.foo.bar.this.that.the.other.a"
whenever you want to use a specific "a". Hence, java import that
specifies an alias.
Using import naturally makes scoping simpler - every name has to be
found in the scope(s) defined in one resource. And you can resolve the
imports separately (also subject to ambiguities btw depending on which
container configuration you use).
Hope that helps.
Regards
- henrik
On 2012-27-07 14:39, Quentin Boucher wrote:
> Hello,
>
> I am quite new to Xtext and trying to implement my language.
> In this language users should be able to use partially and fully
> qualified names. For example, one could use foo.bar.xyz, bar.xyz or xyz
> to reference xyz. The user must use the name which uniquely identifies
> the element since elements might have the same names. For example, the
> user could define a second xyz in bar2. That one would have bar2.xyz as
> unique identifier. However, the user could also use foo.bar2.xyz to
> identify it. She can also use the fully qualified name even if xyz was
> unique. I have read a bit about "QualifiedNameValueConverter" but I
> don't know if this is the right way to go?
>
> Additionally, the user can use shortcuts like "this", "parent",...
>
> Thank you for your help!
|
|
|
|
|
|
Re: (Fully)?QualifiedName [message #901513 is a reply to message #901510] |
Mon, 13 August 2012 08:22 |
|
Hi this is still too complex for a start and not a complete grammar.
Try to solve one problem after another (maybe with another grammar)-
I cannot do this for you (way to much effort)
I'd first try to get simple imports running and then adding the
implicit imports for this and parent and root. Maybe doing the
scoping completely manual (instead of using explicit /implicit
imports via importednamespaceawarelocalscopeprovider is an option
too.
--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07237 seconds