Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Adding attributes to a references element
Adding attributes to a references element [message #1830740] Sun, 02 August 2020 12:51
Avi Shaked is currently offline Avi ShakedFriend
Messages: 116
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

Previous Topic:XText to VSCode integration
Next Topic:DSL Debugger exits the dsl code and enters java code
Goto Forum:
  


Current Time: Sun Oct 25 22:15:06 GMT 2020

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

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

Back to the top