Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [XPAND] complexe SEPARATOR use
[XPAND] complexe SEPARATOR use [message #691530] Fri, 01 July 2011 16:44 Go to next message
Feriaman  is currently offline Feriaman Friend
Messages: 4
Registered: July 2011
Junior Member
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 :
=>green,green


that could be achieve by writing the rule like this :
=>«EXPAND rule FOREACH ABasketOfTomatoesAndCuncumbers SEPARATOR ','»


(Tomato) ---> "" (nothing)


And of course i obtain this :
(Tomato) ---> "=>"


Thanks to every reader.
Thanks to every answerer.
Re: [XPAND] complexe SEPARATOR use [message #691536 is a reply to message #691530] Fri, 01 July 2011 16:59 Go to previous messageGo to next message
Feriaman  is currently offline Feriaman Friend
Messages: 4
Registered: July 2011
Junior Member
I just saw i may be in the wrong section... the XPand section may have been more suitable ?
Sorry if i am wrong.
Re: [XPAND] complexe SEPARATOR use [message #691545 is a reply to message #691530] Fri, 01 July 2011 17:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi, why don't you filter the lists you pass to the foreach e.g. with
a typeselect. Regards Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [XPAND] complexe SEPARATOR use [message #691549 is a reply to message #691545] Fri, 01 July 2011 17:39 Go to previous message
Feriaman  is currently offline Feriaman Friend
Messages: 4
Registered: July 2011
Junior Member
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 17:48]

Report message to a moderator

Previous Topic:Syntax highlight for Enums
Next Topic:Getting an Editor instance/ Resource for a Validator
Goto Forum:
  


Current Time: Tue Apr 23 17:18:45 GMT 2024

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

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

Back to the top