Skip to content
Snippets Groups Projects
Commit 96db0367 authored by George Marchment's avatar George Marchment
Browse files

updated condition extraction

parent 1d3076bb
No related branches found
No related tags found
No related merge requests found
Pipeline #14466 failed with stage
in 2 minutes and 15 seconds
...@@ -164,7 +164,6 @@ class Call(Executor): ...@@ -164,7 +164,6 @@ class Call(Executor):
#Step 2 -> analyse paramters #Step 2 -> analyse paramters
for param in tab_params: for param in tab_params:
analysed_param = False analysed_param = False
if param!='': if param!='':
#Case it's a channel #Case it's a channel
if(re.fullmatch(constant.WORD, param) and not analysed_param): if(re.fullmatch(constant.WORD, param) and not analysed_param):
......
...@@ -46,8 +46,9 @@ class Code: ...@@ -46,8 +46,9 @@ class Code:
extracted_condition = get_code_until_parenthese_count(code=code[end:], val=-1) extracted_condition = get_code_until_parenthese_count(code=code[end:], val=-1)
condition = extracted_condition[:-1] condition = extracted_condition[:-1]
body = extarcted.replace(extracted_condition.strip(), "") body = extarcted.replace(extracted_condition.strip(), "")
new = f"if ({condition}) {{\n{body}\n}}\n" if(body!="" and body[0]!="{"):
to_replace.append((all, new)) new = f"if ({condition}) {{\n{body}\n}}\n"
to_replace.append((all, new))
for r in to_replace: for r in to_replace:
old, new = r old, new = r
code = code.replace(old, new) code = code.replace(old, new)
......
...@@ -1057,6 +1057,8 @@ def extract_conditions(code, only_get_inside = True): ...@@ -1057,6 +1057,8 @@ def extract_conditions(code, only_get_inside = True):
start = end-1 start = end-1
start+=1 start+=1
for c in conditions_dico:
start, end = conditions_dico[c]
return conditions_dico return conditions_dico
def process_2_DSL2(code): def process_2_DSL2(code):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment