Skip to content
Snippets Groups Projects
Commit 3ef72ddf authored by Oraji, Yussur Mustafa's avatar Oraji, Yussur Mustafa
Browse files

Fix some branch C syntax issues

parent 20a74b67
No related branches found
No related tags found
1 merge request!25Draft: Fortran Support
...@@ -8,7 +8,7 @@ from Infrastructure.Instruction import Instruction ...@@ -8,7 +8,7 @@ from Infrastructure.Instruction import Instruction
from Infrastructure.Variables import ERROR_MARKER_COMMENT_BEGIN, ERROR_MARKER_COMMENT_END, ERROR_MARKER_COMMENT_BEGIN_FORT, ERROR_MARKER_COMMENT_END_FORT, adjust_var_language from Infrastructure.Variables import ERROR_MARKER_COMMENT_BEGIN, ERROR_MARKER_COMMENT_END, ERROR_MARKER_COMMENT_BEGIN_FORT, ERROR_MARKER_COMMENT_END_FORT, adjust_var_language
import Infrastructure.Variables as infvars import Infrastructure.Variables as infvars
for_template_c = "for (int i = @START@; i < @END@; ++i)" for_template_c = "for (int i = @START@; i < @END@; ++i) {"
for_template_fort = "do i=@START@, @END@" for_template_fort = "do i=@START@, @END@"
if_template_c = "if (@COND@) {" if_template_c = "if (@COND@) {"
...@@ -46,9 +46,11 @@ class IfBranch(Branch): ...@@ -46,9 +46,11 @@ class IfBranch(Branch):
def header(self): def header(self):
if infvars.generator_language == "c": if infvars.generator_language == "c":
res = if_template_c.replace("@COND@", self._cond) res = if_template_c.replace("@COND@", self._cond)
elseif_str = "} else"
else: else:
res = if_template_fort.replace("@COND@", adjust_var_language(self._cond)).replace("!=", "/=") res = if_template_fort.replace("@COND@", adjust_var_language(self._cond)).replace("!=", "/=")
return res if not self._elseif else f"else {res}" elseif_str = "else"
return res if not self._elseif else f"{elseif_str} {res}"
@override @override
@staticmethod @staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment