From 70ec6933ac3b7cb2018b77b6cb4f226efc02e0cb Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Wed, 30 Oct 2019 18:46:57 +0100 Subject: [PATCH] Feat: missing_times works with RdLeaf --- mapytex/calculus/core/str2.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mapytex/calculus/core/str2.py b/mapytex/calculus/core/str2.py index dfefd17..0dce4ba 100644 --- a/mapytex/calculus/core/str2.py +++ b/mapytex/calculus/core/str2.py @@ -15,7 +15,7 @@ from decimal import Decimal, InvalidOperation from .coroutine import * from .operator import is_operator from .MO import moify_cor -from .random.leaf import look_for_rdleaf +from .random.leaf import look_for_rdleaf, RdLeaf __all__ = ["str2"] @@ -395,8 +395,10 @@ def missing_times(target): elif not is_operator(tok) and tok != ")": target_.send("*") - if isinstance(tok, int) or ( - isinstance(tok, str) and not is_operator(tok) and not tok == "(" + if ( + isinstance(tok, int) + or (isinstance(tok, str) and not is_operator(tok) and not tok == "(") + or (isinstance(tok, RdLeaf)) ): previous = tok @@ -819,7 +821,7 @@ def rdstr2(sink): >>> rdstr2list("{a}+{a*b}-2") [, '+', , '+', ] >>> rdstr2list("{a}({b}x+{c})") - [, [, , '+', ]] + [, '*', [, '*', , '+', ]] """ lfop = lookfor(is_operator) operator_corout = partial(concurent_broadcast, lookfors=[lfop])