Adding attributes to a references element [message #1830740] |
Sun, 02 August 2020 12:51 |
Avi Shaked Messages: 131 Registered: October 2019 |
Senior Member |
|
|
Hi,
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).
Any suggestions?
thanks in advance,
Avi
|
|
|
Powered by
FUDForum. Page generated in 0.02976 seconds