Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.5.1, JRuby 1.5.2, JRuby 1.5.3, JRuby 1.5.4, JRuby 1.5.5, JRuby 1.5.6, JRuby 1.6RC1, JRuby 1.6RC2, JRuby 1.6RC3, JRuby 1.6, JRuby 1.6.1
-
Fix Version/s: JRuby 1.6.6, JRuby 1.7.0.pre1
-
Component/s: Parser
-
Labels:None
-
Environment:tested on Windows, Linux and Android
-
Number of attachments :
Description
Ruby allows equal signs in symbols. Inspecting one of these produces a slightly awkward string:
{:a= => 1}.inspect # => "{:a==>1}"
evaling this string in MRI works:
eval({:a= => 1}.inspect)[:a=] # => 1
If I do the same in JRuby:
eval({:a= => 1}.inspect) # => I get the following error:
SyntaxError: (eval):1: syntax error, unexpected tGT
{:a==>1}
^
from (eval):1
The easiest workaround is to assist the parser:
eval({:a= => 1}.inspect.gsub('==>', '= =>'))[:a=]
This esoteric corner case of the Ruby grammar was fixed on master (8cc3547) and on 1.6 (e36fd2f).
Thank you for reporting. I will work on RubySpec.