Project

General

Profile

Actions

Bug #13967

closed

Recent Ripper changes, sexp broken?

Added by MSP-Greg (Greg L) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-10-03 trunk 60107) [x64-mingw32]
[ruby-core:83089]

Description

With some recent changes, (svn 60103 +), Ripper.sexp has changed. With 60103 +, the second lex shown below no longer has the method name. Old version shows [:@op, "<<", [1, 4]], new version shows simply :on_op

Code:

# frozen_string_literal: true

require 'ripper'
require 'pp'

puts "\n#{RUBY_DESCRIPTION}"

puts "\ndef hello(world) world; end"
pp Ripper.sexp('def hello(world) world; end')

puts "\ndef <<(world) world; end"
pp Ripper.sexp('def <<(world) world; end')

Output from svn 60107

>ruby ripper.rb

ruby 2.5.0dev (2017-10-03 trunk 60107) [x64-mingw32]

def hello(world) world; end
[:program,
 [[:def,
   [:@ident, "hello", [1, 4]],
   [:paren,
    [:params, [[:@ident, "world", [1, 10]]], nil, nil, nil, nil, nil, nil]],
   [:bodystmt, [[:var_ref, [:@ident, "world", [1, 17]]]], nil, nil, nil]]]]

def <<(world) world; end
[:program,
 [[:def,
   :on_op,
   [:paren,
    [:params, [[:@ident, "world", [1, 7]]], nil, nil, nil, nil, nil, nil]],
   [:bodystmt, [[:var_ref, [:@ident, "world", [1, 14]]]], nil, nil, nil]]]]

Output from svn 60101:

>ruby ripper.rb

ruby 2.5.0dev (2017-10-02 trunk 60101) [x64-mingw32]

def hello(world) world; end
[:program,
 [[:def,
   [:@ident, "hello", [1, 4]],
   [:paren,
    [:params, [[:@ident, "world", [1, 10]]], nil, nil, nil, nil, nil, nil]],
   [:bodystmt, [[:var_ref, [:@ident, "world", [1, 17]]]], nil, nil, nil]]]]

def <<(world) world; end
[:program,
 [[:def,
   [:@op, "<<", [1, 4]],
   [:paren,
    [:params, [[:@ident, "world", [1, 7]]], nil, nil, nil, nil, nil, nil]],
   [:bodystmt, [[:var_ref, [:@ident, "world", [1, 14]]]], nil, nil, nil]]]]
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r60113.


parse.y: Revert r60102

Actions

Also available in: Atom PDF

Like0
Like0