Bugs: Browse | Submit New | Admin

[#3361] Ruby 1.8.4 parse errors

Date:
2006-01-29 11:09
Priority:
4
Submitted By:
Tilman Sauerbeck (tilman)
Assigned To:
Shyouhei Urabe (shyouhei)
Category:
Language / Runtime / Core Libraries
State:
Open
Platform:
 
Summary:
Ruby 1.8.4 parse errors

Detailed description
t = Struct.new("Foo", :hour, :min).new
t.hour = t.min = 1
t_offset = (t.hour * 60 * 60) + t.min *60

=> parse error, unexpected tSTAR, expecting $

Changing the end of the line to
"t.min * 60", ie adding a space after the star makes it compile successfully.

This doesn't only affect the '*' operator, but at least '+' suffers from the same bug.

I believe this was introduced with Ruby 1.8.4, but I'm not sure whether it also existed in previous releases.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-06-12 11:00
Sender: Darren Smith

I think that this might not be fixable because, *,+,- all can
have unary meanings. Spaces are used to help determine if a-b
means a subtract b or a(-b).

Functions can accept 0 or more arguments, so it is impossible
to determine if the meaning is unary or binary, that is why it
uses spaces.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
priority32007-06-14 11:44shyouhei
assigned_tonone2007-06-11 22:24zenspider
category_idMisc / Other Standard Library2007-05-29 13:49zenspider
category_idLanguage / Runtime / Core Libraries2007-05-29 11:54zenspider