Hi List
I’ve yet to fully understand the rules behind the parenthesis-less method
invocation syntax. Basically, it seems that while parenthesis-less method
invocation (“command style”) can sometimes be used as an expression, it’s not
universally so.
I’d like to understand whether this is a merely an oversight or due to the
current state of affairs in the parser, or intentional.
Consider:
int a = b c
This is legal and equivalent to
int a = b(c)
similarly:
a = b c
Works fine, too, letting “b c” be a valid expression.
However, the following:
if (b c) {
// Stuff
}
Gives an error:
expecting ‘)’, found ‘c’ at line: 1, column: 11
So, is the “command” syntax a special pseudo-expression, and if so, where is it
allowed? Only by itself (“statement”), and as the RHS og assignments and
initializers?
I’d like to know this as it could get real nasty, depending on the answer,
since allowing it everywhere will introduce some ambiguities, which will
require some tweaks to keep the “non-left-recursion refactored” grammar we have
now.
Also, great news:
Daniel Sun has started contributing fixes, submitting PR’s against the fork at
https://github.com/jespersm/groovy/tree/antlr4
<https://github.com/jespersm/groovy/tree/antlr4> - he’s quite productive,
thanks!
For coordination, I’ve started tracking some of the known “things to do” at
https://github.com/jespersm/groovy/issues
<https://github.com/jespersm/groovy/issues>
-Jesper