#!/usr/local/bin/ruby -ws require 'pp' begin require 'rubygems' rescue LoadError end require 'parse_tree' require 'sexp' $u ||= false $n ||= false $s ||= false $n = $n.intern if $n ARGV.push "-" if ARGV.empty? if $u then require 'sexp_processor' require 'unified_ruby' class Unifier < SexpProcessor include UnifiedRuby end end parse_tree = ParseTree.new unifier = Unifier.new if $u ARGV.each do |file| ruby = file == "-" ? $stdin.read : File.read(file) sexp = Sexp.from_array parse_tree.parse_tree_for_string(ruby, file).first sexp = unifier.process(sexp) if $u sexp = sexp.structure if $s if $n then sexp.each_of_type $n do |node| p node end elsif defined? $q then p sexp else pp sexp end end