our parser does not allows something weird but ruby does:
actually, ruby op are works different ways in some cases.
in this case it will call method -@ of 1(Integer).
but our parser cannot handle these weird case.
because it would not call the method or do something near behavior.
we need to try proto prefix or some other way.
Which implementations and versions of Ruby have you verified this on? I assume that whatever MRI does is "right" and everybody else is wrong or at least inconsistent.
on 1.9.3p0 / 1.9.3p125 / trunk
Ruby Draft Specification defines these unary op in general ways(see 11.4.3) and no descriptions about above weird case.
I guess it may be possible. The specification says "the value of the unary-expression is the resulting value of the invocation". And if the resulting value also has -@ method, it will be evaluated again.
you would like to look around rule "args" on parse.y.
see also lastest ruby draft spec: