[Closed] syntax error inconsistency between ruby -c and ripper

Issue #10405 has been updated by Nobuyoshi N…

Status changed from Feedback to Closed
% Done changed from 0 to 100

Applied in changeset r48144.


parse.y: Ripper.sexp returns error

  • ext/ripper/lib/ripper/sexp.rb (Ripper.sexp, Ripper.sexp_raw):
    return nil on error. [ruby-dev:48678] [Bug #10405]

Bug #10405: syntax error inconsistency between ruby -c and ripper

  • Author: Akira T.
  • Status: Closed
  • Priority: Normal
  • Assignee:
  • Category: ext
  • Target version: current: 2.2.0
  • ruby -v: ruby 2.2.0dev (2014-10-20 trunk 48052) [x86_64-linux]
  • Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN

以下のように、a / b c という内容のファイルを
ruby -c で検査すると syntax error になるのですが
Ripper.sexp に適用するとなにか構文木が返ってきます。

% cat z.rb
a / b c
% ./ruby -c z.rb
z.rb:1: syntax error, unexpected tIDENTIFIER, expecting keyword_do or 
'{' or '('
zsh: exit 1     ./ruby -c z.rb
% ./ruby -rripper -e 'p Ripper.sexp(STDIN.read)' < z.rb
[:program, [:vcall, [:@ident, "c", [1, 6]]]]
% ./ruby -v
ruby 2.2.0dev (2014-10-20 trunk 48052) [x86_64-linux]

これは変な気がするんですがどうでしょうか。