Project

General

Profile

Actions

Backport #1183

closed

Adding support for the new hash literal syntax

Added by knu (Akinori MUSHA) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
[ruby-core:22286]

Description

=begin
Attached is a patch for ruby_1_8 which adds support for the new literal syntax for hash and hash style arguments.

However, there needs some more work to retain the use of colon in place of then/do, in order to keep backward compatibility, although it has been deprecated and dropped in 1.9.

knu@daemon[1]% ruby-1.8.7 -ve 'if true: p(1); end'
ruby 1.8.7 (2008-11-11 patchlevel 73) [x86_64-freebsd7]
1
knu@daemon[1]% ruby-1.8 -ve 'if true: p(1); end'
ruby 1.8.7p5000 (2009-02-19 revision 22433) [x86_64-freebsd7]
-e:1: syntax error, unexpected tLABEL
if true: p(1); end
^
-e:1: syntax error, unexpected kEND, expecting $end
=end


Files

label_hash.patch (4.12 KB) label_hash.patch knu (Akinori MUSHA), 02/20/2009 07:17 PM
tLABEL.patch (4.26 KB) tLABEL.patch a patch to implement "label: value" style hash, for 1.8 shyouhei (Shyouhei Urabe), 07/23/2009 03:49 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0