G
Good Night Moon
Well, it's all in the subject, to me it looks like a parsing bug:
class MyRect
def intersects_good(other)
return (not ((other.x1 < self.x0 or self.x1 < other.x0) and
(other.y1 < self.y0 or self.y1 < other.y0)))
end
def intersects_bad(other)
return not ((other.x1 < self.x0 or self.x1 < other.x0) and
(other.y1 < self.y0 or self.y1 < other.y0))
end
end
foo> ruby -c myrect.rb
myrect.rb:8: syntax error, unexpected kNOT, expecting kEND
return not ((other.x1 < self.x0 or self.x1 < other.x0) and
^
Any comment? Is this known? Or just some hair in the Ruby grammar?
class MyRect
def intersects_good(other)
return (not ((other.x1 < self.x0 or self.x1 < other.x0) and
(other.y1 < self.y0 or self.y1 < other.y0)))
end
def intersects_bad(other)
return not ((other.x1 < self.x0 or self.x1 < other.x0) and
(other.y1 < self.y0 or self.y1 < other.y0))
end
end
foo> ruby -c myrect.rb
myrect.rb:8: syntax error, unexpected kNOT, expecting kEND
return not ((other.x1 < self.x0 or self.x1 < other.x0) and
^
Any comment? Is this known? Or just some hair in the Ruby grammar?