Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Organizing logical combination of boolean expressions in a HOT
Organizing logical combination of boolean expressions in a HOT [message #1115733] Tue, 24 September 2013 13:56 Go to next message
EtienneB Mising name is currently offline EtienneB Mising name
Messages: 35
Registered: June 2011
Member
Dear all,

I am facing a new problem when doing a HOT. I have a source rule that specifies something like this:

rule example
{
    from
        s: MM_Exp!MC1
	(
	    (
	        (s.name='My1' and s.id='My2')
	        or
	        (s.name='My2' and s.id='My2')
	    )
	    and
	    (
	        (s.name='My3' and s.id='My4')
	        or
	        (s.name='My4' and s.id='My5')
	    )
...
}


the target rule comes out as follows after unparsing the result of the HOT:

rule example
{
    from
        s: MM_Exp!MC1
	(
	        s.name='My1' and s.id='My2'
	        or
	        s.name='My2' and s.id='My2'
	    and
	        s.name='My3' and s.id='My4'
	        or
	        s.name='My4' and s.id='My5'
	    )
...
}


So in other words, it looks like I lose the parenthesis when running the HOT which looks very unsafe to me. Is this something I noticed because I was considering special cases where parenthesis were not useful or is it something documented with a way to workaround it?

Thanks a lot for your help,
Etienne.

[Updated on: Tue, 24 September 2013 18:08]

Report message to a moderator

Re: Organizing logical combination of boolean expressions in a HOT [message #1118790 is a reply to message #1115733] Fri, 27 September 2013 19:47 Go to previous message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 166
Registered: September 2012
Senior Member

The ATL parser/pretty-printer normally takes care of this: unnecessary parentheses are removed. When creating your own ATL AST in a HOT, you just need to take care that the tree structure is correct. The ATL pretty-printer should place the necessary parentheses (you can test this with an AND-containing-OR tree, which should put parentheses around the OR).

Cheers,
Dennis
Previous Topic:How to create a call to a helper in a HOT?
Next Topic:Inject operation in ATL 3.0
Goto Forum:
  


Current Time: Sat Oct 25 14:38:09 GMT 2014

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

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