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