Yukihiro Matsumoto wrote:
> Hi,
> 
> In message "Re: [ruby-core:25713] [Bug #2131] f(not x) => syntax error"
>     on Wed, 23 Sep 2009 00:13:06 +0900, "James M. Lawrence" <redmine / ruby-lang.org> writes:
> 
> |This should have been classified as a feature request.
> |
> |Since (not x) is legal syntax, it is my opinion that f(not x) should be legal.
> 
> So, do you mean a,b,c = 1,2,3 is legal syntax, should we allow
> f(a,b,c = 1,2,3) ?
> 
> In fact, it's matter of precedence, kinda difficult to "fix".

f(a,b,c=1,2,3) is actually legal, tho the commas are method parameter
commas, not multiple assignment commas.

I think I get it now; the precedence of comma is higher than that of
and/or/not, so the problem is not so much in parsing
  f(x and y)
which should be straightforward, but more complicated related cases like
  f(x and y,z)
which would parse somewhat like
  f(x and (y,z))
which makes no sense. Ideally, one would like to have 'and' be higher
precedence than ',' in this particular case. Getting precedence
exceptions like that to work is tricky and ugly; I can understand now
why you'd rather avoid it. My own parser has the same issue with 'and'
and 'or'.

Curiously, tho, RedParse is able to parse
  f(not x,y)
and
  f(not x)
in exactly the way I (and the OP) expect; ',' is lower precedence than
'not'.