Project

General

Profile

Actions

Backport #2233

closed

[PATCH] Ripper parsing Proc call as: f.() or f::() crashes

Added by akeep (Andy Keep) over 14 years ago. Updated almost 13 years ago.

Status:
Closed
[ruby-core:26165]

Description

=begin
Ripper seems to crash (with YARV and C stack trace) when trying to parse the two Proc call conveniences added to Ruby 1.9.x where the 'call' keyword is eliminated.

Ripper.sexp("f.()")

Ripper.sexp("f::()")

The problem seems to be that Ripper is inserting 'call' in the parse stream but was using rb_intern instead of ripper_intern. The included patch calls the ripper_intern and fixes the crash.

With the patch:

Ripper.sexp("f.()")
=> [:program, [[:method_add_arg, [:call, [:paren, [:var_ref, [:ident, "f", [1, 0]]]], :".", :call], [:arg_paren, nil]]]]
Ripper.sexp("f::()")
=> [:program, [[:method_add_arg, [:call, [:paren, [:var_ref, [:ident, "f", [1, 0]]]], :"::", :call], [:arg_paren, nil]]]]
=end


Files

parse.y.callless_call_patch (684 Bytes) parse.y.callless_call_patch Patch to fix Ripper handling of call-less calls (i.e. if f is a Proc, f.() and f::()) akeep (Andy Keep), 10/20/2009 01:13 AM
parse.y.callless_call_patch (810 Bytes) parse.y.callless_call_patch Patch to fix Ripper handling of call-less calls (i.e. if f is a Proc, f.() and f::()) akeep (Andy Keep), 10/20/2009 05:16 AM
Actions #1

Updated by akeep (Andy Keep) over 14 years ago

=begin
A small addenda, it seems like the current version of the ripper code was (needlessly?) adding an extra set of parenthesis to the parser results. So f.() was parsed as (f).call() and f::() was parsed as (f).call(). I've re-patched it to remove the extra (). (The original patch fixed f::() being parsed as f.call() instead of f::call()).
=end

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r25405.
Andy, thank you for your reporting of the issue.
You have greatfully contributed toward Ruby.
May Ruby be with you.

=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 14 years ago

  • Status changed from Closed to Assigned
  • Assignee set to yugui (Yuki Sonoda)

=begin

=end

Actions #4

Updated by yugui (Yuki Sonoda) over 14 years ago

  • Status changed from Assigned to Closed

=begin
This issue was solved with changeset r26013.
Andy, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0