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

Fixing some bugs (DSL1 -> DSL2)

parent bc249642
No related branches found
No related tags found
No related merge requests found
Pipeline #14311 failed with stage
in 2 minutes and 32 seconds
......@@ -124,7 +124,7 @@ END_PIPE_OPERATOR = r"\s*(\s*\|\s*\w+)+"
# PROCESS
#--------------------------
FILE = r'file +(\w+) *\n'
FROM = r'from([^\n]+)\n'
FROM = r' from ([^\n]+)\n'
INPUT = r"\n\s*input *:"
INTO = r'into +([\w, ]+)'
INTO_2 = r'into +\(?( *\w+ *(, *\w+)*) *\)?'
......
......@@ -348,8 +348,9 @@ class Nextflow_Building_Blocks:
parenthese_left, parenthese_right = get_parenthese_count(text[:start]), get_parenthese_count(text[end:])
#if(curly_left==0 and curly_right==0 and parenthese_left==0 and parenthese_right==0 and (start, end) not in searched):
if(parenthese_left==0 and parenthese_right==0 and (start, end) not in searched):
searched.append((start, end))
#if(parenthese_left==0 and parenthese_right==0 and (start, end, temp) not in searched):
if(parenthese_left==0 and parenthese_right==0):
try:
pot = extract_executor_from_middle(text, start, end)
......@@ -361,37 +362,39 @@ class Nextflow_Building_Blocks:
raise BioFlowInsightError(f"Failed to extract the operation or call{self.get_string_line(temp)}. Try rewriting it in a simplified version.", num = 11, origin=self)
pot = expand_to_pipe_operators(text, pot)
#If the thing which is extracted is not in the conditon of an if
if(not checks_in_condition_if(text, pot) and not checks_in_string(text, pot)):
if(self.get_DSL()=="DSL2"):
to_call = self.get_list_name_processes()+self.get_list_name_subworkflows()+self.get_list_name_includes()
if(pot.find("|")!=-1):
if(not checks_in_condition_if(pot, '|') and not checks_in_string(pot, '|')):#TODO checks_in_string is the first occurance
first_thing_called = pot.split('|')[-1].strip()
if(first_thing_called in to_call):
call = Call(code =pot, origin =self)
self.executors.append(call)
elif(first_thing_called in constant.LIST_OPERATORS):
ope = Operation(code =pot, origin =self)
self.executors.append(ope)
#IF the exact potential hasn't already been searched, then we don't do it
if((start, end, pot) not in searched):
searched.append((start, end, pot))
#If the thing which is extracted is not in the conditon of an if
if(not checks_in_condition_if(text, pot) and not checks_in_string(text, pot)):
if(self.get_DSL()=="DSL2"):
to_call = self.get_list_name_processes()+self.get_list_name_subworkflows()+self.get_list_name_includes()
if(pot.find("|")!=-1):
if(not checks_in_condition_if(pot, '|') and not checks_in_string(pot, '|')):#TODO checks_in_string is the first occurance
first_thing_called = pot.split('|')[-1].strip()
if(first_thing_called in to_call):
call = Call(code =pot, origin =self)
self.executors.append(call)
elif(first_thing_called in constant.LIST_OPERATORS):
ope = Operation(code =pot, origin =self)
self.executors.append(ope)
else:
raise BioFlowInsightError(f"'{first_thing_called}' is neither a process, subworkflow or an operator. In the executor '{pot}'{self.get_string_line(pot)}.", num=14,origin=self)#TODO -> try rewriting the operation using the standard syntaxe
else:
raise BioFlowInsightError(f"'{first_thing_called}' is neither a process, subworkflow or an operator. In the executor '{pot}'{self.get_string_line(pot)}.", num=14,origin=self)#TODO -> try rewriting the operation using the standard syntaxe
from .executor import Executor
executor = Executor(pot, self)
self.executors.append(executor.return_type())
else:
from .executor import Executor
executor = Executor(pot, self)
self.executors.append(executor.return_type())
else:
from .executor import Executor
executor = Executor(pot, self)
self.executors.append(executor.return_type())
else:
ope = Operation(pot, self)
self.executors.append(ope)
searching = True
break
ope = Operation(pot, self)
self.executors.append(ope)
searching = True
break
#---------------------------------------------------------------
......
......@@ -585,12 +585,12 @@ class Process(Nextflow_Building_Blocks):
lines.append(line)
code = "\n".join(lines)
#Removing the extra emits
#For it to only have one
#For it to only have one,
for line in self.outputs_per_line:
def replacer(match):
return ""
return match.group(1)
for o in line[1:]:
code = re.sub(fr"\,\s*{re.escape(o.get_code())}", replacer, code)
code = re.sub(fr"\,\s*{re.escape(o.get_code())}(\s|\,|\))", replacer, code)
return 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