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

update identification doucle dot operation

parent c2fde659
No related branches found
No related tags found
No related merge requests found
Pipeline #14117 passed with stage
in 3 minutes and 11 seconds
......@@ -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)
......
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