Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Boolean operators in version 3.2
[Acceleo] Boolean operators in version 3.2 [message #901400] Sat, 11 August 2012 19:08 Go to next message
Luís de Sousa is currently offline Luís de SousaFriend
Messages: 214
Registered: July 2009
Senior Member
Dear all,

I need to perform a boolean comparison in an if block. Something like:

[if (class.getTaggedValue(class, 'Stereotype', 'initRandom') == 'TRUE')]

According to the 2.6 reference manual, the following operators should be available (page 9):

Quote:
== (equal), != (different), < (less than), <= (less or equal than), > (greater than >= (greater than or equal), || (logical or), && (logical and) and ! (negation)


But whenever I use them I get this error: "=" unexpected token(s). Am I doing something wrong? Or have the boolean operators changed since version 2.6?

Thank you,

Luís

Re: [Acceleo] Boolean operators in version 3.2 [message #901455 is a reply to message #901400] Sun, 12 August 2012 15:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I've no idea about 2.x, but Acceleo 3.x complies with the OMG MOFM2T
specification that is based on OCL, for which the relational operators are

=, <>, <=, <, >, >=

and the literals are

true, false

Regards

Ed Willink

On 11/08/2012 20:08, Luís de Sousa wrote:
> Dear all,
>
> I need to perform a boolean comparison in an if block. Something like:
>
> [if (class.getTaggedValue(class, 'Stereotype', 'initRandom') == 'TRUE')]
>
> According to the 2.6 reference manual, the following operators should
> be available (page 9):
>
> Quote:
>> == (equal), != (different), < (less than), <= (less or equal than), >
>> (greater than >= (greater than or equal), || (logical or), &&
>> (logical and) and ! (negation)
>
>
> But whenever I use them I get this error: "=" unexpected token(s). Am
> I doing something wrong? Or have the boolean operators changed since
> version 2.6?
>
> Thank you,
>
> Luís
>
>
Re: [Acceleo] Boolean operators in version 3.2 [message #901522 is a reply to message #901455] Mon, 13 August 2012 08:44 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

The answer provided by Ed is correct "==" is not valid in Acceleo 3 (use "=" instead). Acceleo 2.x and Acceleo 3.x do not use the same languages so there are some differences. You can have a look at the documentation of the language and all its available operations.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau & @acceleo
Google+: stephane.begaudeau & acceleo
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Re: [Acceleo] Boolean operators in version 3.2 [message #901647 is a reply to message #901522] Mon, 13 August 2012 20:01 Go to previous message
Luís de Sousa is currently offline Luís de SousaFriend
Messages: 214
Registered: July 2009
Senior Member
Thanks to both for the replies. Using the "=" character things work fine.

Luís
Previous Topic:Questions about generation code for Objective C and small games for iPhone
Next Topic:Acceleo meta-model as namespace
Goto Forum:
  


Current Time: Fri Apr 19 22:26:18 GMT 2024

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

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

Back to the top