How to imply a value for a field via the grammar [message #1033457] |
Thu, 04 April 2013 08:42 |
Chris Ainsley Messages: 78 Registered: March 2010 Location: UK |
Member |
|
|
Hello,
I have designed a DOM-like DSL, and created a basic XText definition.
Node:
(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.
Thanks.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03014 seconds