|
@@ -100,13 +100,18 @@ def translateStatement(s, state): |
|
|
|
|
|
|
|
|
# Keep "if not (" |
|
|
# Keep "if not (" |
|
|
if ss == "if not (": |
|
|
if ss == "if not (": |
|
|
state.isIf = True |
|
|
|
|
|
return f"{indentation}if !(" |
|
|
|
|
|
|
|
|
state.isIfNot = True |
|
|
|
|
|
return f"{indentation}if (!(" |
|
|
|
|
|
|
|
|
# ): -> } |
|
|
# ): -> } |
|
|
if ss == "):": |
|
|
if ss == "):": |
|
|
state.isIf = False |
|
|
|
|
|
return f"{indentation}) {{" |
|
|
|
|
|
|
|
|
# if |
|
|
|
|
|
if state.isIf: |
|
|
|
|
|
state.isIf = False |
|
|
|
|
|
return f"{indentation}) {{" |
|
|
|
|
|
# if not |
|
|
|
|
|
state.isIfNot = False |
|
|
|
|
|
return f"{indentation})) {{" |
|
|
|
|
|
|
|
|
ending = ";" |
|
|
ending = ";" |
|
|
if state.isIf: |
|
|
if state.isIf: |
|
@@ -132,6 +137,7 @@ class CPP: |
|
|
def __init__(self, fn): |
|
|
def __init__(self, fn): |
|
|
self.fn = fn |
|
|
self.fn = fn |
|
|
self.isIf = False |
|
|
self.isIf = False |
|
|
|
|
|
self.isIfNot = False |
|
|
|
|
|
|
|
|
def translate(self): |
|
|
def translate(self): |
|
|
returnType = translateType(self.fn.returnType) |
|
|
returnType = translateType(self.fn.returnType) |
|
|