diff --git a/src/call.py b/src/call.py index 41bba12b1f9329966c5ad3d55c0a1d78c02b0f69..6361913114cd46dbf7864e79fc3c0e72bffd6558 100644 --- a/src/call.py +++ b/src/call.py @@ -164,7 +164,6 @@ class Call(Executor): #Step 2 -> analyse paramters for param in tab_params: analysed_param = False - if param!='': #Case it's a channel if(re.fullmatch(constant.WORD, param) and not analysed_param): diff --git a/src/code_.py b/src/code_.py index cb7b985702091c2b28920853bdd6a5cdeac5526b..d4d4b4b332be45cf655f55435a1d4124f9dab2e0 100644 --- a/src/code_.py +++ b/src/code_.py @@ -46,8 +46,9 @@ class Code: extracted_condition = get_code_until_parenthese_count(code=code[end:], val=-1) condition = extracted_condition[:-1] body = extarcted.replace(extracted_condition.strip(), "") - new = f"if ({condition}) {{\n{body}\n}}\n" - to_replace.append((all, new)) + if(body!="" and body[0]!="{"): + new = f"if ({condition}) {{\n{body}\n}}\n" + to_replace.append((all, new)) for r in to_replace: old, new = r code = code.replace(old, new) diff --git a/src/outils.py b/src/outils.py index 9491059ecbe8e5966fdf5b3353d18fdab81431f8..bcaa57ea602ba64e86bbc9b6761ded47331114c4 100644 --- a/src/outils.py +++ b/src/outils.py @@ -1057,6 +1057,8 @@ def extract_conditions(code, only_get_inside = True): start = end-1 start+=1 + for c in conditions_dico: + start, end = conditions_dico[c] return conditions_dico def process_2_DSL2(code):