From: Peter Hickman Date: 2011-01-17T20:45:22+09:00 Subject: Re: Obscure syntax error Well, and I have to admit I am guessing here, the source is parsed in the context of the code that precedes it. So 'x :y' is parsed when nothing (no method or variable) called x exists so the parser is thinking that x should be a method, because it has not been told otherwise and the :y makes sense as a parameter to a method. In the case of 'x = nil; x :y' the 'x = nil' means that we now have something defined for x (a variable) which the parser can then take into account when it gets to 'x :y'. Whereas before with 'x :y' it assumes that x is a method because x has not been defined. But with 'x = nil; x :y' we know that x is a variable and the parser no longer assumes that x is a method and tries to make sense of 'a variable' followed by 'a symbol'. Which make no sense, thus the error. I don't know if this is the case as I do not routinely browse the Ruby parser code but from what I know this makes sense - even if I may not have explained it clearly.