java - Xtext Adding values to the grammar manually -
i have grammar can parse list of containers , modules, generate these containers in alphabetical order. but, want add together module names container list.
for example:
with configuration: container cont1; container cont2; module external priority 1; module internal priority 2; generated file should have: main() { container(cont1); container(cont2); container(external); container(internal); } i able generate in container configuration. want merge module names "internal" , "external" container. sort them alphabetically.
is there way in xtext? , belong generator or scoping part?
this should go generator. need generate list of container , module nodes. assume you've written generator in xtend:
val list = lists.newarraylist( model.containers ) list.addall( model.modules ) iterate on sorted list:
for( part : list.sortby(e|e.name) ) { part.generatecontainer() } and 1 generatecontainer() method per type.
java xtext xtend
No comments:
Post a Comment