Manipulating the model in Xtext [message #663743] |
Wed, 06 April 2011 07:33  |
Eclipse User |
|
|
|
Hello,
This is a rather generic question: I was wondering if you could manipulate in some way the model within the grammar definition.
Let's take a very easy example: suppose that in our metamodel we have an EClass called "Entity" which has a name and a data attributes (both EString).
In our Xtext grammar we have a rule like this for the Entity:
Entity:
'Entity' name=ID;
Now suppose that I automatically want to assign the name of the Entity to the data attribute (so, in the model in memory we will have an entity with the name and data attribute being the same).
Is this possible to modify the grammar rule to do something like that ?
Of course, in the example here it doesn't have a lot of advantages but sometimes it could be useful to be able to manipulate the model in order to automatically fill some parts of it.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04007 seconds