Sha256: ebb2c3a83f02ba1e7c1785555a3bb052b385e294d636614f9656c944f95a8eb9

Contents?: true

Size: 707 Bytes

Versions: 11

Compression:

Stored size: 707 Bytes

Contents

#!/usr/bin/env ruby -ws

$b ||= false # bug mode -- ripper is buggy, use Ripper.sexp
$d ||= false # debug -- turn on yydebug
$p ||= false # Use pp

require "ripper/sexp"
require "pp" if $p

if ARGV.empty? then
  warn "reading from stdin"
  ARGV << "-"
end

class MySexpBuilder < Ripper::SexpBuilderPP
  def on_parse_error msg
    Kernel.warn msg
  end
end

ARGV.each do |path|
  src = path == "-" ? $stdin.read : File.read(path)

  sexp = nil

  if $b then
    sexp = Ripper.sexp src
  else
    rip = MySexpBuilder.new src
    rip.yydebug = $d
    sexp = rip.parse

    if rip.error? then
      warn "skipping"
      next
    end
  end

  puts "accept"

  if $p then
    pp sexp
  else
    p sexp
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
brakeman-6.2.2 bundle/ruby/3.1.0/gems/ruby_parser-3.20.3/tools/ripper.rb
brakeman-6.2.2.rc1 bundle/ruby/3.3.0/gems/ruby_parser-3.20.3/tools/ripper.rb
brakeman-6.2.1 bundle/ruby/3.1.0/gems/ruby_parser-3.20.3/tools/ripper.rb
brakeman-6.2.0 bundle/ruby/3.1.0/gems/ruby_parser-3.20.3/tools/ripper.rb
ruby_parser-3.21.1 tools/ripper.rb
brakeman-6.1.2 bundle/ruby/3.3.0/gems/ruby_parser-3.20.3/tools/ripper.rb
ruby_parser-3.21.0 tools/ripper.rb
brakeman-6.1.1 bundle/ruby/3.0.0/gems/ruby_parser-3.20.3/tools/ripper.rb
brakeman-6.1.0 bundle/ruby/3.1.0/gems/ruby_parser-3.20.3/tools/ripper.rb
brakeman-6.0.1 bundle/ruby/3.1.0/gems/ruby_parser-3.20.3/tools/ripper.rb
ruby_parser-3.20.3 tools/ripper.rb