Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to imply a value for a field via the grammar
How to imply a value for a field via the grammar [message #1033457] Thu, 04 April 2013 08:42 Go to next message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
Registered: March 2010
Location: UK

I have designed a DOM-like DSL, and created a basic XText definition.

	 (type=ID  name=STRING  )
	 (items+=ModelItem*) '}'

NodeWithoutId returns Node:
	 ( (type=ID ))
	 (items+=ModelItem*) '}'

The 'type' field represents the type of a node, and the 'name' field represents the identifier of a field.

I have two types of node. One with an id and one without an ID, and I'm auto-generating the model from the .xtext file.

My question is, for NodeWithoutId, how do I set the name and the type field to the value of what is currently just the type field? That is, for Node, the name and type should be independent, but for the NodeWithoutId grammar, the name and the type should be one word in the grammar but the same value should be stored in both the name and the type fields.

Re: How to imply a value for a field via the grammar [message #1034618 is a reply to message #1033457] Fri, 05 April 2013 17:13 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13709
Registered: July 2009
Senior Member

are you talking about cross refs (in this case a iqualifiednameprovider customization would do the trick)
if you want a eoperation or a derived eattribute in the metamodel then have a look at

for an example

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Indentation around formatting
Next Topic:Context sensitive references?
Goto Forum:

Current Time: Tue Jan 19 13:07:47 GMT 2021

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

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

Back to the top