[Acceleo 3 / MTL] Variables in MTL? [message #634648] |
Fri, 22 October 2010 15:01 |
Emilio Salazar Messages: 9 Registered: October 2009 |
Junior Member |
|
|
Dear all,
Reading the MTL Standard (v1.0) I have found in one of its examples (Example 3, Annex A) a syntax construction that seems to be a sort of variable declaration. In the standard's example is used to create a counter.
As this feature would be very handy for me, I've tried to use this in Acceleo MTL, but I'm not able to avoid errors.
First, I tried to "copy and paste" the standard's example, but it didn't compiled. Then I discovered that if I changed the line
[TEMPLATE PUBLIC class_header (...) {int count = -1}]
by this other (1):
[TEMPLATE PUBLIC class_header (...) {count : Integer = -1}]
the MTL compiler accepted the line. This line seems to have the same effect than a FOR + LET instruction, since 'count' is visible inside of the loop's scope, and you can print it.
My problem is when I try to copy the part in which the counter is incremented. The standard's version is
[FOR (...) {count = count + 1;}]
but this raises a compilation error.
I've been trying different combinations without successful.
Is this feature supported in Acceleo MTL?
If so, what syntax should I use?
There is any way to use variables inside of MTL?
Thank you very much in advance.
Regards,
Emilio.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04116 seconds