Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problems with Scoping(acessing elements over different scopes)
Problems with Scoping [message #689845] Tue, 28 June 2011 13:49 Go to next message
java is currently offline javaFriend
Messages: 2
Registered: June 2011
Junior Member
Hi everybody.

I am trying to find a possibility to access elements over different modules.
My xText grammar looks like this:

Model :
	(imports+=Import)*
	(modules+=Module)*
	;

Import :
	'import' importURI=STRING
	;

Module:
	'module' name=ID
		(statements+=Statement)*
	'end'
	;
[...]


A test example which should run looks like this:

module General
	statement GeneralStatement
	end
end

module Module01
	
	application myApplication
	   statement Module01Statement
	   statement GeneralStatement
	end
	   
	statement Module01Statement 
	end
end
	   


By default my project is using AbstractDeclarativeScopeProvider.
This does not work (it says, that Module01Statement can not be found).
I also tried to use DefaultGlobalScopeProvider. That results in all Statements marked as not been found.

Could you give me some hint what to do? Use another ScopeProvider? Write my own? The xText-User-Guide didn't help me in what I was looking for. (Nevertheless it is a very good Guide!)


[Updated on: Wed, 29 June 2011 10:42]

Report message to a moderator

Re: Problems with Scoping [message #689848 is a reply to message #689845] Tue, 28 June 2011 13:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

Can you share your complete grammar. do you want to have import uri based scoping oder name based scoping (what did you configure in the workflow?)

btw have a look at the IQualifiedNameProvider too if the statments come from different modules Wink

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 28 June 2011 13:52]

Report message to a moderator

Re: Problems with Scoping [message #690342 is a reply to message #689848] Wed, 29 June 2011 11:58 Go to previous messageGo to next message
java is currently offline javaFriend
Messages: 2
Registered: June 2011
Junior Member
Hi Christian,

thanks for your fast response. It really helped me. It helped me in the way that you asked the right question. Smile
I was always thinking that I am using uri based scoping but did now realize that I think I didn't.
Previously my mwe2 workflow had the lines:

	// scoping and exporting API 
	fragment = scoping.ImportNamespacesScopingFragment {}
	fragment = exporting.QualifiedNamesFragment {}
	fragment = builder.BuilderIntegrationFragment {}


and I now switched it to

	// scoping and exporting API
	fragment = scoping.ImportURIScopingFragment {}
	fragment = exporting.SimpleNamesFragment {}


And now it seems to work. (Statements are found across module borders)
I have still another problem concerning dublicate Elements, but I will post that in another thread.

Thanks!
Michael
Re: Problems with Scoping [message #690352 is a reply to message #690342] Wed, 29 June 2011 12:18 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

if you use Xtext 2.0.0 you have to disable TypeGeneratorFragment for importURIs too.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:changing semantic model at runtime
Next Topic:TypeProvider implementation
Goto Forum:
  


Current Time: Fri Apr 19 22:30:37 GMT 2024

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

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

Back to the top