From: nobu@... Date: 2016-03-20T22:42:26+00:00 Subject: [ruby-core:74480] [Ruby trunk Bug#12200][Closed] MRI 2.2.4 parser forces blanks for hash keys which point to an array literal Issue #12200 has been updated by Nobuyoshi Nakada. Status changed from Open to Closed ---------------------------------------- Bug #12200: MRI 2.2.4 parser forces blanks for hash keys which point to an array literal https://bugs.ruby-lang.org/issues/12200#change-57600 * Author: Christian Aust * Status: Closed * Priority: Normal * Assignee: * ruby -v: ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- In MRI 2.2.3 and below this was valid code: ~~~ $ ruby -v -e 'a={ name:%w(a b c) }; puts a' ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15] {:name=>["a", "b", "c"]} ~~~ In MRI 2.2.4 the same code will generate a syntax error: ~~~ $ ruby -v -e 'a={ name:%w(a b c) }; puts a' ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15] -e:1: syntax error, unexpected '%' a={ name:%w(a b c)}; puts a ^ -e:1: syntax error, unexpected '}', expecting end-of-input a={ name:%w(a b c)}; puts a ^ ~~~ However, adding a blank between the **:** and the **%** fixes the error: ~~~ $ ruby -v -e 'a={ name: %w(a b c) }; puts a' ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15] {:name=>["a", "b", "c"]} ~~~ Is this the intended behavior? Regards Christian -- https://bugs.ruby-lang.org/ Unsubscribe: