This commit is contained in:
Михаил Капелько
2024-04-29 14:06:14 +03:00
parent 467ba0ff81
commit 52ed3385a8
5 changed files with 61 additions and 24 deletions

View File

@@ -4,6 +4,7 @@ def includes():
return """#include <map>
#include <string>
#include <vector>
#include "memory.h"
#include "memory_Context.h"
"""
@@ -47,6 +48,7 @@ def translateStatement(s, state):
ss = s.lstrip()
posColon = ss.find(": ")
posComma = ss.find(", ")
posComment = ss.find("# ")
posCtx = ss.find("c.")
posEqual = ss.find(" = ")
posFor = ss.find("for ")
@@ -56,6 +58,10 @@ def translateStatement(s, state):
posClosingScope = ss.find("#}")
posOpenSquareBracket = ss.find("[")
# # -> //
if posComment != -1:
return replaceComment(s)
# #} -> }
if posClosingScope != -1:
return f"{indentation}}}"