Rakefile in ruby_parser-3.12.0 vs Rakefile in ruby_parser-3.13.0

- old
+ new

@@ -1,24 +1,21 @@ # -*- ruby -*- -$:.unshift "../../hoe/dev/lib" - require "rubygems" require "hoe" Hoe.plugin :seattlerb Hoe.plugin :racc Hoe.plugin :isolate Hoe.plugin :rdoc +Hoe.add_include_dirs File.expand_path "~/Links/SP/lib" # HACK Hoe.add_include_dirs "../../sexp_processor/dev/lib" Hoe.add_include_dirs "../../minitest/dev/lib" Hoe.add_include_dirs "../../oedipus_lex/dev/lib" -V1 = %w[18 19] -V2 = %w[20 21 22 23 24 25] -V1_2 = V1 + V2 +V2 = %w[20 21 22 23 24 25 26] Hoe.spec "ruby_parser" do developer "Ryan Davis", "ryand-ruby@zenspider.com" license "MIT" @@ -26,11 +23,11 @@ dependency "sexp_processor", "~> 4.9" dependency "rake", "< 11", :developer dependency "oedipus_lex", "~> 2.5", :developer if plugin? :perforce then # generated files - V1_2.each do |n| + V2.each do |n| self.perforce_ignore << "lib/ruby#{n}_parser.rb" end V2.each do |n| self.perforce_ignore << "lib/ruby#{n}_parser.y" @@ -49,13 +46,11 @@ V2.each do |n| file "lib/ruby#{n}_parser.y" => "lib/ruby_parser.yy" do |t| cmd = 'unifdef -tk -DV=%s -UDEAD %s > %s || true' % [n, t.source, t.name] sh cmd end -end -V1_2.each do |n| file "lib/ruby#{n}_parser.rb" => "lib/ruby#{n}_parser.y" end file "lib/ruby_lexer.rex.rb" => "lib/ruby_lexer.rex" @@ -110,61 +105,64 @@ parse_y = "parse#{v}.y" tarball = "ruby-#{version}.tar.bz2" ruby_dir = "ruby-#{version}" diff = "diff#{v}.diff" rp_out = "lib/ruby#{v}_parser.output" + rp_y = "lib/ruby#{v}_parser.y" + rp_y_rb = "lib/ruby#{v}_parser.rb" c_diff = "compare/#{diff}" c_rp_txt = "compare/#{rp_txt}" c_mri_txt = "compare/#{mri_txt}" c_parse_y = "compare/#{parse_y}" c_tarball = "compare/#{tarball}" + normalize = "compare/normalize.rb" - file tarball do + file c_tarball do in_compare do dl version end end file c_parse_y => c_tarball do in_compare do system "tar yxf #{tarball} #{ruby_dir}/{id.h,parse.y,tool/{id2token.rb,vpath.rb}}" Dir.chdir ruby_dir do if File.exist? "tool/id2token.rb" then - sh "ruby tool/id2token.rb --path-separator=.:./ id.h parse.y > ../#{parse_y}" + sh "ruby tool/id2token.rb --path-separator=.:./ id.h parse.y | expand > ../#{parse_y}" else - cp "parse.y", "../#{parse_y}" + sh "expand parse.y > ../#{parse_y}" end end sh "rm -rf #{ruby_dir}" end end - file c_mri_txt => c_parse_y do + file c_mri_txt => [c_parse_y, normalize] do in_compare do sh "bison -r all #{parse_y}" sh "./normalize.rb parse#{v}.output > #{mri_txt}" rm ["parse#{v}.output", "parse#{v}.tab.c"] end end - file rp_out => :parser + file rp_out => rp_y_rb - file c_rp_txt => rp_out do + file c_rp_txt => [rp_out, normalize] do in_compare do sh "./normalize.rb ../#{rp_out} > #{rp_txt}" end end compare = "compare#{v}" desc "Compare all grammars to MRI" task :compare => compare - task c_diff => [c_mri_txt, c_rp_txt] do + file c_diff => [c_mri_txt, c_rp_txt] do in_compare do - system "diff -du #{mri_txt} #{rp_txt} > #{diff}" + sh "diff -du #{mri_txt} #{rp_txt} > #{diff}; true" end end desc "Compare #{v} grammar to MRI #{version}" task compare => c_diff do @@ -172,28 +170,30 @@ system "wc -l #{diff}" end end task :clean do - rm_f Dir[c_parse_y, c_mri_txt, c_rp_txt] + rm_f Dir[c_mri_txt, c_rp_txt] end task :realclean do - rm_f Dir[tarball] + rm_f Dir[c_parse_y, tarball] end end -ruby_parse "1.8.7-p374" -ruby_parse "1.9.3-p551" +# ruby_parse "1.8.7-p374" +# ruby_parse "1.9.3-p551" ruby_parse "2.0.0-p648" ruby_parse "2.1.9" -ruby_parse "2.2.6" -ruby_parse "2.3.3" -# TODO ruby_parse "2.4.0" +ruby_parse "2.2.9" +ruby_parse "2.3.8" +ruby_parse "2.4.5" +ruby_parse "2.5.3" +ruby_parse "2.6.1" task :debug => :isolate do - ENV["V"] ||= V1_2.last + ENV["V"] ||= V2.last Rake.application[:parser].invoke # this way we can have DEBUG set Rake.application[:lexer].invoke # this way we can have DEBUG set $: << "lib" require "ruby_parser" @@ -224,16 +224,29 @@ lines = src[0..ss.pos].split(/\n/) abort "on #{file}:#{lines.size}" end end -task :debug_ruby do - file = ENV["F"] || ENV["FILE"] - sh "/Users/ryan/Desktop/DVDs/debugparser/miniruby -cwy #{file} 2>&1 | ./yuck.rb" +task :debug3 do + file = ENV["F"] + verbose = ENV["V"] ? "-v" : "" + munge = "./tools/munge.rb #{verbose}" + + abort "Need a file to parse, via: F=path.rb" unless file + + ENV.delete "V" + + sh "ruby -y #{file} 2>&1 | #{munge} > tmp/ruby" + sh "./tools/ripper.rb -d #{file} | #{munge} > tmp/rip" + sh "rake debug F=#{file} DEBUG=1 V=25 2>&1 | #{munge} > tmp/rp" end +task :cmp3 do + sh %(emacsclient --eval '(ediff-files3 "tmp/ruby" "tmp/rip" "tmp/rp")') +end + task :extract => :isolate do - ENV["V"] ||= V1_2.last + ENV["V"] ||= V2.last Rake.application[:parser].invoke # this way we can have DEBUG set file = ENV["F"] || ENV["FILE"] ruby "-Ilib", "bin/ruby_parse_extract_error", file