A lot of ruby syntax and parsing is relatively logical, but am I confused by how Ruby knows from the context, what 2 /3/ 4is 2 ÷ 3 ÷ 4 instead of parsing /3/as a regular expression? This is the correct parsing, but is /3/also a valid regular expression and how it finds out that /3/it is not a regular expression.
I thought it might be a numerical literal thing, but if you do
a = 6
b = 4
c = 2
a /b/ c
Ruby still parses this as a division. How it works?
Actually, I realized that this question is more
let's say i have it
def a(x)
x
end
a = 4
b = 2
i = 4
a /b/i
How is it a /b/ianalyzed as 0instead of /b/i
as in why is it a /b/ianalyzed as a./(b./(i))instead of a(/b/i)?