#!/usr/bin/env ruby ## Copyright © 2017 Graham Sanderson ## DeCompat: ZScript ↔ DECORATE shared syntax preprocessor. def todec fp, out for ln in fp ln = ln.chomp.sub(//, "actor").sub(//, "const int") if ln.include? "" or ln.include? "" then next elsif ln.include? "" out.write " states\n {\n" elsif ln.include? "" out.write " }\n" else out.write ln + "\n" end end end for arg in ARGV fp = open(arg, "rt") dec = fp.gets[15..-1].chomp todec fp, open(dec, "wt") end ## EOF