diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-08-30 14:53:58 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-08-30 14:53:58 -0300 |
commit | 394c58ebe18f4c7b5ad3a0a75d32d9f89e343e32 (patch) | |
tree | a17770f0aa8db6d7636e74cac7cd4efd642909d6 | |
parent | 2381bf69f6a5c6a559a0fb5d3d749f4a60672066 (diff) | |
download | renpy-394c58ebe18f4c7b5ad3a0a75d32d9f89e343e32.tar.gz renpy-394c58ebe18f4c7b5ad3a0a75d32d9f89e343e32.tar.bz2 renpy-394c58ebe18f4c7b5ad3a0a75d32d9f89e343e32.tar.xz renpy-394c58ebe18f4c7b5ad3a0a75d32d9f89e343e32.zip |
While this is still ugly, at least now it will fail in a less ugly way.
...Well, still useless given Ren'Py handles stuff diferently and some ident errors.
-rw-r--r-- | rparse.py | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -4,7 +4,29 @@ def fm(f): return os.getcwd()+"/debug/"+f for f in os.listdir(os.getcwd()+"/debug"): - print("mv \"%s\" \"%s\"" % (fm(f), fm(f.replace(".rpy", ".py")))) - subprocess.call("mv \"%s\" \"%s\"" % (fm(f), fm(f.replace(".rpy", ".py"))), shell=True) + #print("mv \"%s\" \"%s\"" % (fm(f), fm(f.replace(".rpy", ".py")))) + #subprocess.call("mv \"%s\" \"%s\"" % (fm(f), fm(f.replace(".rpy", ".py"))), shell=True) + with open(os.getcwd()+"/debug/"+f, "r") as fp: + on=False + ind="" + lv=0 + ft = open(os.getcwd()+"/debug/"+f+"-sast.py", "w") + ft.write("if True:\n") + for l in fp: + if on: + if not l.startswith(ind): + on=False + continue + ft.write(l) + if ind == "": + for c in l: + if c == " ": + ind+=" " + if "python" in l: + on=True + ind="" + if " $" in l: + ft.write(" "+l.replace("$", "").lstrip()) + ft.close() subprocess.call("ls \"%s\"" % os.getcwd()+"/debug", shell=True) |