Organizing logical combination of boolean expressions in a HOT [message #1115733] |
Tue, 24 September 2013 13:56 |
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 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03064 seconds