adding default members [message #1475478] |
Sun, 16 November 2014 08:57 |
Yoel Pinhas Messages: 17 Registered: October 2013 |
Junior Member |
|
|
Hi All,
Lets say I have the following grammar:
Entity: 'entity' name=ID '{' members+=Member* '}';
Member: Field | Method;
Field: 'val' type=[Entity] name=ID
Method: 'def' type=[Entity] name=ID '{' expressions+=Expression* '}'
I would like to have a field member for each entity named 'this' the type of the entity itself, and, a method named 'this' with the same type as well.
the poor-man solution i currently use is to validate that are indeed such members (with the correct type and name)
but this is boilerplate code that i would like to avoid since it repeats itself.
I've tried to create a new Field using emf factory create methods and add it to the entity instance but i got a 'dangling reference' error message
What is a proper way of doing this?
Thank you in advance
[Updated on: Sun, 16 November 2014 09:05] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03264 seconds