Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » another code generation question
another code generation question [message #1696020] Thu, 21 May 2015 08:19 Go to next message
Simon Ziehme is currently offline Simon ZiehmeFriend
Messages: 22
Registered: November 2013
Junior Member
Hi all,

i generate c++ - code, or rather inludes.

The problem is, maybe the first statement generate the same "include" as the second statement.

1)
«FOR name : coin.attributes.map[entity.name].toSet.sortBy[it]»#include "«name».pb.hpp"
«ENDFOR»


2)
«FOR name : coin.methods.map[params.name].toSet.sortBy[it]»#include "«name».pb.hpp"
«ENDFOR»


How can i combine both statements to prevent duplicat "include" ?

Thanks
Simon

[Updated on: Thu, 21 May 2015 08:26]

Report message to a moderator

Re: another code generation question [message #1696025 is a reply to message #1696020] Thu, 21 May 2015 09:09 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
Hi

you can create a joint list e.g. using the list literal

«FOR name : #[coin.attributes.map[entity.name],coin.methods.map[params.name]].flatten.toSet.sortBy[it]»#include "«name».pb.hpp"
«ENDFOR»


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: another code generation question [message #1696044 is a reply to message #1696025] Thu, 21 May 2015 10:53 Go to previous message
Simon Ziehme is currently offline Simon ZiehmeFriend
Messages: 22
Registered: November 2013
Junior Member
Thanks!
Previous Topic:cross-reference ambiguity with grammar rules
Next Topic:Serializer fails (grammar based on existing ecore)
Goto Forum:
  


Current Time: Sun Apr 18 09:51:47 GMT 2021

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

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

Back to the top