Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Question on cross-referencing and scoping
Question on cross-referencing and scoping [message #1016248] Tue, 05 March 2013 16:01 Go to next message
Marco Naddeo is currently offline Marco NaddeoFriend
Messages: 62
Registered: November 2012
Member
Hi all Smile

I have a question on cross-referencing and scoping: if I declare in my DSL grammar a cross-reference and I do not define a particular scope for it, which is the default one?

If my cross-reference has type T, should I always see all occurences of T in the model, right?
Re: Question on cross-referencing and scoping [message #1016255 is a reply to message #1016248] Tue, 05 March 2013 16:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi

you see all instances of T (inclusive subtypes) in all model files in the project (and referenced ones) if they are exported to the xtext index (= have a name attribute)

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Question on cross-referencing and scoping [message #1016256 is a reply to message #1016255] Tue, 05 March 2013 16:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
P.S:

And the qualified name has to be serializable at the point

[T] is short for the [T|ID] => a ID will parsed and you wont see thze objects if their name contains a .


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Question on cross-referencing and scoping [message #1016422 is a reply to message #1016256] Wed, 06 March 2013 12:06 Go to previous messageGo to next message
Marco Naddeo is currently offline Marco NaddeoFriend
Messages: 62
Registered: November 2012
Member
Christian Dietrich wrote on Tue, 05 March 2013 11:41
P.S:

And the qualified name has to be serializable at the point

[T] is short for the [T|ID] => a ID will parsed and you wont see thze objects if their name contains a .


I think this is my problem, because on method content assist I only see the methods declared in the same mixin where I'm writing code, and not the others.

And in fact I'm using qualified names:

fragment = exporting.QualifiedNamesFragment {}


However, as in Java editor, on a method call I don't want to refer to the called method using a qualified name as (for example):

ClassName.methodName


but a simple one:

methodName


How can I get this? Rolling Eyes I have to enable the SimpleNamesFragment instead of the QualifiedNamesFragment one?


Thanks in advance,
Marco
Re: Question on cross-referencing and scoping [message #1016444 is a reply to message #1016422] Wed, 06 March 2013 13:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Did you try [T|FQN]
With FQN : ID ("." ID)*;

--
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
Re: Question on cross-referencing and scoping [message #1016456 is a reply to message #1016444] Wed, 06 March 2013 14:10 Go to previous messageGo to next message
Marco Naddeo is currently offline Marco NaddeoFriend
Messages: 62
Registered: November 2012
Member
Yes, I tried, in that way I see all methods in content assist drop-down, but I obtain this error message when I generate Xtext Artifacts from grammar:

Decision can match input such as "'.' RULE_ID '.' RULE_ID '.' RULE_ID '.' RULE_ID" using multiple alternatives: 1, 2


that is, my grammar is now ambiguous, right?
Re: Question on cross-referencing and scoping [message #1016461 is a reply to message #1016456] Wed, 06 March 2013 14:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Yes so you can either fix that use simple name provider or give
explicitly a simple name in the defaultdeclarativenameprovider

--
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
Re: Question on cross-referencing and scoping [message #1016977 is a reply to message #1016255] Fri, 08 March 2013 12:39 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 03/05/2013 05:40 PM, Christian Dietrich wrote:
> Hi
>
> you see all instances of T (inclusive subtypes) in all model files in
> the project (and referenced ones) if they are exported to the xtext
> index (= have a name attribute)
>
> ~Christian

Sorry if I jump in the discussion:
if there are containment relations the default scoping will take care of
that, won't it? Because of the default qualified name provider which
takes containment relation into account, right?

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it


Previous Topic:Errors and Warnings while running workflow
Next Topic:2-step generating
Goto Forum:
  


Current Time: Thu Apr 18 14:41:59 GMT 2024

Powered by FUDForum. Page generated in 0.02283 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top