Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsAdding attributes to a references element
https://www.eclipse.org/forums/index.php/mv/msg/1104750/1830740/#msg_1830740
I am making my first steps in using Xtext, so please excuse me if this is too basic.
I am interested in having a languages that creates a database of items and sets their properties. Accordingly I wish to have the following syntax for two separate delcarations:
1. Add item %itemName with property %propertyName1.
2. Add property %propertyName2 to %ItemName
an example for use:
Add item item1 with property p1
Add property p2 to item1
The first statement is simple to create. For example:
Item:
'Add' 'item' name=ID (property+=Property)*;
Property:
'property' name=ID;
The second statement is something I need your help with: I understand that I can reference predefined items using itemName=[Item], but how do I add a property to the item?
I tried this:
AddProperty:
'add' propertyName=Property 'to' itemName=[Item]
But it does not work... (the property is added to an 'unnamed' item and not the referenced one).