Eval error for hashes containing symbols ending with an equals sign
-------------------------------------------------------------------

                 Key: JRUBY-5792
                 URL: http://jira.codehaus.org/browse/JRUBY-5792
             Project: JRuby
          Issue Type: Bug
          Components: Parser
    Affects Versions: JRuby 1.6.1, JRuby 1.6, JRuby 1.6RC3, JRuby 1.6RC2, JRuby 
1.6RC1, JRuby 1.5.6, JRuby 1.5.5, JRuby 1.5.4, JRuby 1.5.3, JRuby 1.5.2, JRuby 
1.5.1
         Environment: tested on Windows, Linux and Android
            Reporter: Scott Moyer
            Assignee: Thomas E Enebo
            Priority: Minor


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 message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to