oop-c/parse.rb

17 lines
313 B
Ruby
Raw Permalink Normal View History

2018-06-04 09:06:12 -05:00
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