Skip to content

Ripper.sexp unexpectedly returns nil when given source includes keyword-ish symbol #4562

@yujinakayama

Description

@yujinakayama

On JRuby 9.x.x.x Ripper.sexp unexpectedly returns nil when given source includes keyword-ish symbol such as :if and :unless (not sure if there're any more).

Environment

$ jruby --version
jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.25-b02 on 1.8.0_25-b17 +jit [darwin-x86_64]
$ uname -a
Darwin macbookpro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

Expected Behavior

Ripper.sexp should return an array for source including :if, as MRI does:

$ ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
$ irb
irb(main):001:0> require 'ripper'
=> true
irb(main):002:0> Ripper.sexp(':if')
=> [:program, [[:symbol_literal, [:symbol, [:@kw, "if", [1, 1]]]]]]

Actual Behavior

Ripper.sexp returns nil for source including :if:

$ irb
irb(main):001:0> JRUBY_VERSION
=> "9.1.8.0"
irb(main):002:0> RUBY_VERSION
=> "2.3.1"
irb(main):003:0> require 'ripper'
=> true
irb(main):004:0> Ripper.sexp(':if')
=> nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions