| Generating Objects [message #953886] |
Mon, 22 October 2012 12:08  |
Dana Klein Messages: 54 Registered: October 2012 |
Member |
|
|
Hi,
I want to know how (if possible) to generate more properties on objects in xtext.
I have xtext file similar to the xtext describe in here:
(www.ebpml.org/blog2/index.php/2010/11/05/mde-xtext-and-json)
JSONDataSource: root = Object ;
Object: '{' firstObject=TerminalObject (',' objects+=TerminalObject)* '}';
Array: '['firstItem=ObjectValue (',' items+=ObjectValue)* ']';
EmptyObject: isEmpty?= '{}' ;
EmptyArray: isEmpty?= '[]' ;
ObjectValue: value=STRING | Object | Array | EmptyObject | EmptyArray ;
TerminalObject: element=STRING ':' (content = ObjectValue) ;
So after generating the code I have all the objects generated in java and now in order to get into a TerminalObject content ("b" -> such as "a":"b") i need to iterate the object until i get there, so what i'm asking exactly can I generate more properties than the basic one?
|
|
|