Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » acceleo : support for variable increment in for loops?
acceleo : support for variable increment in for loops? [message #701715] Mon, 25 July 2011 13:33 Go to next message
Leonardo Kenji Shikida is currently offline Leonardo Kenji ShikidaFriend
Messages: 37
Registered: July 2009
Member
Hi

in the example #3 (A.3) from http://www.omg.org/spec/MOFM2T/1.0/ document, there´s a snippet like this

[module class_header_gen /]
[template public class_header(c : Class) { int count = -1; } ]
[file (c.name +'.cpp', false)]
[trace(c.id() +'_header')]
// Bit vector #definies
[for(a : Attribute) | c.attribute) { count = count + 1; }]
#define [a.name/]_BIT [count/]
[/for]
(...)

Acceleo has support for such a construct?

I´ve tried something similar but it did not work. Is there any way to do something like this using acceleo?

TIA

Kenji
Re: acceleo : support for variable increment in for loops? [message #702302 is a reply to message #701715] Tue, 26 July 2011 07:50 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Kenji,

Long story short, this example is syntactically wrong, as are a number of the 'examples' shown in the specification; see my full answer on http://www.eclipse.org/forums/index.php/m/65064/?srch=counter#msg_65064 .

If what you need is the iteration count, you can use the implicit variable "[i/]" within a for loop :

[for(a : Attribute | c.attribute)]
#define [a.name/]_BIT [i/]
[/for]

Laurent Goubet
Obeo
Re: acceleo : support for variable increment in for loops? [message #702484 is a reply to message #702302] Tue, 26 July 2011 12:35 Go to previous message
Leonardo Kenji Shikida is currently offline Leonardo Kenji ShikidaFriend
Messages: 37
Registered: July 2009
Member
Hi Laurent

the implicit variable will work

Thanks a lot

Kenji
Previous Topic:[MWE] Use metamodel from other plugin
Next Topic:[JET] Can JET accept variables of the array type?
Goto Forum:
  


Current Time: Fri Mar 29 15:34:59 GMT 2024

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

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

Back to the top