Project

General

Profile

Actions

Bug #11914

closed

2.2.4: Parsing "symbol:%w(word)" gives SyntaxError

Added by allenfair (Allen Fair) almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin14]
[ruby-core:72572]

Description

This snippet does not parse correctly, only in ruby 2.2.4: {a:%w(a)}
Adding a space after the "a:" works.

irb(main):001:0> RUBY_VERSION
=> "2.2.4"
irb(main):002:0> {a:%w(a)}
SyntaxError: (irb):2: syntax error, unexpected '%'
{a:%w(a)}
    ^
(irb):2: syntax error, unexpected '}', expecting end-of-input
    from /Users/allen/.rbenv/versions/2.2.4/bin/irb:11:in `<main>'
irb(main):003:0> {a: %w(a)}
=> {:a=>["a"]}

This works (without the space) in 2.2.3 and 2.3.0

Work-around: add the space after the colon.

My search failed to find an existing issue, but hope this isn't a repeat.

Thanks!


Related issues

Is duplicate of Ruby master - Bug #11833: 2.2.4 syntax error when naked percent notation touches keyword arguments ClosedActions
Is duplicate of Ruby master - Bug #11812: Lack of space between colon and % literal causes syntax errorClosedActions
Actions #1

Updated by hsbt (Hiroshi SHIBATA) almost 6 years ago

  • Is duplicate of Bug #11833: 2.2.4 syntax error when naked percent notation touches keyword arguments added

Updated by hsbt (Hiroshi SHIBATA) almost 6 years ago

  • Status changed from Open to Closed
Actions #3

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Is duplicate of Bug #11812: Lack of space between colon and % literal causes syntax error added

Updated by usa (Usaku NAKAMURA) over 5 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE, 2.3: DONTNEED
Actions

Also available in: Atom PDF