diff --git a/src/operation.py b/src/operation.py index 47a9fd3915028b1f4f9d8dc561616aec7b9d85ba..5a9044887cf1ab2db836d0b6789824e4f204b73a 100644 --- a/src/operation.py +++ b/src/operation.py @@ -7,7 +7,7 @@ import warnings #- add a list of words illegal for channel eg. [true, process, workflow...] import re -from .outils import get_end_operator, get_end_call +from .outils import get_end_operator, get_end_call, get_curly_count from .code_ import Code from .executor import Executor from .bioflowinsighterror import BioFlowInsightError @@ -718,12 +718,23 @@ class Operation(Executor): # self.calls[str(call)] = call # break - + #Returns if the code if a double dot pattern or not + def check_if_double_dot(self): + pattern = constant.DOUBLE_DOT + is_a_match = bool(re.fullmatch(pattern, self.get_code(clean_pipe = False))) + if(is_a_match): + is_good = True + for match in re.finditer(pattern, self.get_code(clean_pipe = False)): + if(get_curly_count(match.group(2))!=0 or get_curly_count(match.group(3))!=0): + is_good= False + return is_good + + else: + return False def initialise(self): - pattern = constant.DOUBLE_DOT #If the operation is a double dot consition thing - if(bool(re.fullmatch(pattern, self.get_code(clean_pipe = False)))): + if(self.check_if_double_dot()): self.initialise_double_dot() elif(bool(re.fullmatch(constant.DOUBLE_DOT_TUPLE, self.get_code(clean_pipe = False)))): raise BioFlowInsightError(f"A ternary conditional operator was used with an tuple{self.get_string_line(self.get_code(clean_pipe = False))}. BioFlow-Insight doesn't support this yet (see specification list), try defining the operation in a different way.", num=5, origin=self)