[grammarians] ambiguity with method call?
mental@rydia.net
mental at rydia.net
Tue Nov 29 19:58:03 EST 2005
Wait. All of you. Thank you very much, but all those additional
details don't alter the way 'foo[1]' and 'foo [1]' are parsed.
Doesn't matter how many arguments a foo method takes. Doesn't
matter whether a foo lvar references an Array, a Proc, or Cheese.
Please have pity on Ter and stick to minimal complete examples like
these (each parsed separately):
1. foo[1]
2. foo [1]
3. foo = nil
foo[1]
4. foo = nil
foo [1]
Then focus on the relevent differences:
space no space
method: foo([1]) foo.[](1)
lvar: foo.[](1) foo.[](1)
So, there are really only two possibilities he has to consider:
method, with space: foo([1])
any other combination of method/lvar/space: foo.[](1)
[ side note: it is good to point out, as Brian did, when a
particular construct (#2 in this case) is deprecated. Sure, we'll
still have to parse it for the time being, but we can at least
stick a comment in the grammar. ]
-mental
More information about the Rubygrammar-grammarians
mailing list