Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » validating colliding import
validating colliding import [message #1477186] Mon, 17 November 2014 17:51
Yoel Pinhas is currently offline Yoel PinhasFriend
Messages: 17
Registered: October 2013
Junior Member
Hi,

Let's say we have this grammar
Model: 
	'package' name=FQN
	imports+=Import*
	entities+=Entity*;

Import: 
	'import' importedNamespace=FQNWithWildCards;

Entity: 
	'entity' name=ID '{' members+=Member * '};

Member: 
	'val' type=[Entity] name=ID; 


And lets say we have these entities:
package somewhere.a1
entity A {}

package somewhere.else.a2
entity A {}

package my_test
import somewhere.a1.*
import somewhere.else.a2.*
entity MyTest {
	val A a
}


here is the problem: I get an 'unresolved reference' on 'A'
-- this is by itself is fine by me, but the user can't really learn what went wrong here...

My solution is to validate every import, consult the indexer to come up with the list of entities this import adds, and check that no other import adds entities with the same local name.

I would like to know if there is a 'proper' xtext way doing this Smile or perhaps if there are some classes i should reuse

Thanks in advance, yoel
Previous Topic:Problem with templates in Xtext
Next Topic:customizing the outline view
Goto Forum:
  


Current Time: Fri Apr 26 06:18:36 GMT 2024

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

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

Back to the top