diff --git a/src/outils.py b/src/outils.py index a5d8d5c26504b19ed77ed24809e2b5064f8a8421..a4da11a5c2551cd94ff273b4897876e5d341e012 100644 --- a/src/outils.py +++ b/src/outils.py @@ -996,8 +996,11 @@ def extract_conditions(code, only_get_inside = True): searching_for_else = False conditions = [] if(code[start:start+2]=="if" and [quote_single, quote_double, triple_single, triple_double]==[False, False, False, False]): - - for match in re.finditer(r"if *\(((.|\n)+)\)\s*\{", code[start:]): + for match in re.finditer(r"if *\([^{]+\n", code[start:]): + if(match.span(0)[0]==0): + raise BioFlowInsightError(f"The condition '({match.group(0).strip()}' was not extracted correctly. It's perhaps due to the jump line in the condition. Make sure the condition follows the correct syntaxe.", type="Unable to extract condition") + + for match in re.finditer(r"if *\((.+)\)\s*\{", code[start:]): if(match.span(0)[0]==0): found_if_bloc = True condition = match.group(1)