From: nobu@... Date: 2014-11-19T18:11:25+00:00 Subject: [ruby-dev:48739] [ruby-trunk - Bug #10437] [Closed] ruby -c and ripper inconsistency: /*/ Issue #10437 has been updated by Nobuyoshi Nakada. Status changed from Open to Closed % Done changed from 0 to 100 Applied in changeset r48507. ---------- ChangeLog: add issue ref * ChangeLog: r48504 fixed [ruby-dev:48714] [Bug #10437] ---------------------------------------- Bug #10437: ruby -c and ripper inconsistency: /*/ https://bugs.ruby-lang.org/issues/10437#change-50016 * Author: Akira Tanaka * Status: Closed * Priority: Normal * Assignee: * Category: * Target version: * ruby -v: ruby 2.2.0dev (2014-10-27 trunk 48168) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- /*/ という、間違った regexp リテラルは ruby -c ではちゃんとエラーになるのですが、 Ripper.sexp ではエラーになりません。 ``` % cat z.rb /*/ % ruby -c z.rb z.rb:1: target of repeat operator is not specified: /*/ % ruby -rripper -e 'p Ripper.sexp(STDIN.read)' < z.rb [:program, [[:regexp_literal, [[:@tstring_content, "*", [1, 1]]], [:@regexp_end, "/", [1, 2]]]]] % ruby -v ruby 2.2.0dev (2014-10-27 trunk 48168) [x86_64-linux] ``` Ripper では regexp object を作らないからでしょうが、 syntax error を調べる目的に対して不都合ではあります。 -- https://bugs.ruby-lang.org/