From 63b9ec04aec76324e26f08e7e7240747fe575735 Mon Sep 17 00:00:00 2001 From: George Marchment <georgemarchment@yahoo.fr> Date: Mon, 19 Feb 2024 10:01:29 +0100 Subject: [PATCH] Update -> error tuple with emit --- src/bioflowinsighterror.py | 2 ++ src/constant.py | 1 + src/operation.py | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/src/bioflowinsighterror.py b/src/bioflowinsighterror.py index 83ca4b7..d76b296 100644 --- a/src/bioflowinsighterror.py +++ b/src/bioflowinsighterror.py @@ -41,6 +41,8 @@ class BioFlowInsightError(Exception): #* [1] -> presence of an import java or groovy (NOT USED RIGHT NOW) #* [3] -> unkonwn thing in a pipe operator #* [5] -> A ternary conditional operator was used with an tuple +#* [7] -> Tuple with emit (ch1, ch2) = emit.out + diff --git a/src/constant.py b/src/constant.py index 9411239..5c11ebc 100644 --- a/src/constant.py +++ b/src/constant.py @@ -66,6 +66,7 @@ EMIT_EQUALS = r"\w+\s*=\s*((\w+)\s*\.\s*(output|out))[^\w]" EMIT_NAME = r'(\w+)\s*\.\s*(output|out)\s*\.\s*(\w+)' EMIT_OPERATION = r"(\w+)\s*\.\s*(output|out)\s*[^\w]" EMIT_TAB = r'(\w+)\s*\.\s*(output|out)\s*\[\s*(\d+)\s*\]' +TUPLE_EMIT = r'\( *\w+( *\, *\w+)+ *\) *= *'+EMIT_ALONE # FUNCTION diff --git a/src/operation.py b/src/operation.py index 11a5503..b5e0da1 100644 --- a/src/operation.py +++ b/src/operation.py @@ -364,6 +364,15 @@ class Operation(Executor): if(bool(re.fullmatch(constant.WORD, name))): self.add_origin(name) + #================================ + #Case (ch1, ch2, ...) = emit.out + #================================ + pattern= constant.TUPLE_EMIT + for match in re.finditer(pattern, operation): + raise BioFlowInsightError(f"A tuple is associated with an emit{self.get_string_line(self.get_code(clean_pipe = False))}. BioFlow-Insight doesn't support this (see specification list), try defining the operation in a different way.", num=7, origin=self) + + + #================================ #Case (ch1, ch2, ...) = channel.something #================================ -- GitLab