Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Setting the key value for a map from imported ecpre model
Setting the key value for a map from imported ecpre model [message #1032278] Tue, 02 April 2013 20:09
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Hi All,

I am writing a DSL for my ecore model in which I have references to map of <String, eObject>. The problem I have is that the DSL needs to follow the older versions of this languages so when I define a parser rule for map I cannot set the key. So my parser rule for map is

objMap returns MyEcoreEMap:
value = object

But as you can guess I get the error of having conflicts between key index 0 and 1 as the key string is not in the rule.

What I need is to set the key automatically based on the eObject.toString().

How can I solve this? I tried to modify the setTypedValue of the MyEcoreEmapImpl class (so that it sets the key automatically to eobject.toString() ) but that'd not the methods called for setting the value. I don't know which method is called when a map is used.

I think a post processing step with lazy linker may do it. But I don't have any idea how to do it and how it'd look like.

I really appreciate your help! Thanks.

[Updated on: Tue, 02 April 2013 22:24]

Report message to a moderator

Previous Topic:Why there is an additional ".smap" file when code are automatically generated?
Next Topic:Cross Referencing with a different attribute of a rule
Goto Forum:

Current Time: Fri Jan 24 18:10:31 GMT 2020

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

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

Back to the top