class SimplifyArithmetic
Public Class Methods
replace(*args)
click to toggle source
# File src/simplify/simplify_arithmetic.rb, line 66 def self.replace(*args) self.new.replace(*args) end
Public Instance Methods
replace(input,output)
click to toggle source
# File src/simplify/simplify_arithmetic.rb, line 70 def replace(input,output) rewriter = SimplifyArithmeticAst.new input.each_line do |line| # Looks to match lines with references if line =~ /:arithmetic/ content = line.split("\t") ast = eval(content.pop) output.puts "#{content.join("\t")}\t#{rewriter.map(ast).inspect}" else output.puts line end end end