farleyknight / ionize

Convert Php to Ruby (Will soon die and be reborn as something different..)

This URL has Read+Write access

farleyknight (author)
Fri Nov 28 11:30:39 -0800 2008
commit  ba7f7a914cb4c4cf3117d4559b213be99fc3fd88
tree    958c7b3813dc6c0b0c8cf1e83a1894a2c4546b4b
parent  70f7ccaa7641cefb1e08b10bbd873349773fe8e7
ionize / tasks / recompile.rake
100644 18 lines (15 sloc) 0.588 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
desc "Recompile Ionize's Parser"
task :recompile do
  my_filename = "lib/ionize/parser.rb"
  compiled_filename = "lib/ionize/compiled_parser.rb"
 
  if File.stat(my_filename).ctime > File.stat(compiled_filename).ctime
    puts "Grammar newer than CompiledParser. Recompiling.."
    null = Object.new.instance_eval do
      def method_missing(*args, &blk); end
      self
    end
    File.open("lib/ionize/compiled_parser.rb", "w+") do |f|
      f.write(Dhaka::Parser.new(Ionize::Php::Grammar, null).compile_to_ruby_source_as("Ionize::Php::CompiledParser"))
    end
  end
end