oop-c/parse.rb
2018-06-04 09:06:12 -05:00

17 lines
313 B
Ruby

inf=File.read("main.c")
updfile=File.read("main.c").split("\n")
i=0
inf.each_line do |line|
if /\A(.+)\.(.+);/.match line.strip
obj=$1
fname=$2
updfile[i]="#{" "*line.index(/[^ ]/)}#{obj}->#{fname}(#{obj})"
end
i+=1
end
f=File.open("main.c","a")
f.puts
f.puts
f.print updfile.join("\n")
f.close