From: Rick DeNatale Date: 2007-07-26T01:51:34+09:00 Subject: Re: Parsing bug with 'return not' (was, Syntax bug) On 7/22/07, Gregory Brown wrote: > On 7/22/07, Good Night Moon wrote: > > On Sun, 22 Jul 2007 03:50:01 -0400, Bil Kleb wrote: > > >> myrect.rb:8: syntax error, unexpected kNOT, expecting kEND > > >> return not ((other.x1 < self.x0 or self.x1 < other.x0) and > > > > > > You need to use the '!' operator instead of the 'not' "conjunction". > > > It's a precedence thing -- the parser is seeing 'return not' -- see > > > parse.y in the source. > > > > Thanks, maybe I'll look. It's not just precedence though, or else > > 'return' itself is part of it: > > if binds differently than return. It is precedence. Except that return isn't an operator. As far as I can tell, looking at parse.y for ruby1.8.6 the parse tree for the original statement which raised the question return not true should be: command_call kRETURN expr kNOT expr primary var_ref variable kTRUE There definitely looks to be something strange here. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/