[XPAND] complexe SEPARATOR use [message #691530] |
Fri, 01 July 2011 12:44  |
Eclipse User |
|
|
|
Hi everyone.
I'm Feriaman, i use XPand in a XText project, it is really impressive. I carefully readed the manual, but i cannot find a way to do something that should be pretty easy.
First question :
I'd like to make a rule like this :
«EXPAND rule FOREACH ABasketOfTomatoesAndCuncumbers SEPARATOR ','»
with :
«DEFINE rule FOR Tomato»«ENDDEFINE»
«DEFINE rule FOR Cuncumber»green«ENDDEFINE»
And I'd like to obtain this :
(Tomato,Cuncumber,Tomato,Tomato,Cuncumber) ---> green,green
But of course i obtain :
(Tomato,Cuncumber,Tomato,Tomato,Cuncumber) ---> ,green,,,green
Second question :
In fact i'd like to output a keword before my enumeration, something like this :
that could be achieve by writing the rule like this :
=>«EXPAND rule FOREACH ABasketOfTomatoesAndCuncumbers SEPARATOR ','»
(Tomato) ---> "" (nothing)
And of course i obtain this :
Thanks to every reader.
Thanks to every answerer.
|
|
|
|
|
Re: [XPAND] complexe SEPARATOR use [message #691549 is a reply to message #691545] |
Fri, 01 July 2011 13:39  |
Eclipse User |
|
|
|
Hi Christian
Thanks alot you solve my problem and made me realize i could use the "Special Collection operations" inside the ".xpt" file ... that i haven't realized yet.
Thanks again.
«IF ABasketOfTomatoesAndCuncumbers.typeSelect(Cuncumber).select(c | c.diametre > 4) != {}-»
«EXPAND rule FOREACH ABasketOfTomatoesAndCuncumbers.typeSelect(Cuncumber).select(c | c.diametre > 4) SEPARATOR ','-»
«ENDIF-»
[Updated on: Fri, 01 July 2011 13:48] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.09699 seconds