code generation with Xtend -


i implementing own dsl , using xtend generate c code. have developed small prototype using xpand/xtend need convert prototype xtend.

in xpand, used define "generate" function generate c file don't know how can similar thing using xtend. in regard highly appreciated.

«define generate dsl::defs::module» «file "com.c" -» /* date «datestring()» */ «expand com_c::com_def_c » «endfile» «enddefine» 

thanks , regards, hemal bavishi

you this:

def xtendfunc() ''' /* date «datestring()» */ ''' 

or

def xtendfunc() { var = '''/* date «datestring()» */''' return var } 

(assuming 'datestring()' function in same class) in xtend called using template expressions(enclosed within 3 quotes '''...'''). can contain result of function in val (final variable in xtend) first case. use function other template com_c:com_def_c. append result variable , write file using simple java.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -