representing this in the AST is not the primary issue here. There are several idioms in Groovy and most of our grammar is based on different forms of method calls. For example
can be seen as a method call to the method "if" with two parameters that are "b" and the block "
". When I now look at
doSomething() unless (x > 10)
then I see a method call "doSomething()" like before with the if, but what follows? I can't be a method call if multiple arguments, because of the () and because no block follows. So what is it then? The solution I showed is based on an expression consisting of
and a method called on the result of that expression. So in my view it does not fit the overall style used in Groovy and I am tempted to say no to this, if your example is the only usage of a whole new idiom.