# Pythonize C/C++/C# code -- move all '{' and '}' out of site, beyond the right border import sys def debrace( rp: int, fn: str ): f = open( fn, "rt" ) if f: fo = open( fn+".out", "wt" ) out = "" sfx = "" for ln in f: ln = ln.rstrip() sln = ln.lstrip() if sln == "{": sfx += "{" elif sln == "}": sfx += "}" elif sln == "};": sfx += "};" else: while ln.strip().startswith("}"): p = ln.index("}") sfx += "}" ln = ln[:p]+ln[p+1:].strip() if out.lstrip().startswith("#"): print( out, file=fo ) if sfx: print( ' '*(rp)+sfx, file=fo ) sfx = "" out = ln continue if out.endswith("\\"): out = out[:-1].rstrip() if len(out)