Feat: missing_times works with RdLeaf

This commit is contained in:
Bertrand Benjamin 2019-10-30 18:46:57 +01:00
parent 91779bd945
commit 70ec6933ac

View File

@ -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")
[<RdLeaf a>, '+', <RdLeaf a*b>, '+', <MOnumber - 2>]
>>> rdstr2list("{a}({b}x+{c})")
[<RdLeaf a>, [<RdLeaf b>, <MOstr x>, '+', <RdLeaf c>]]
[<RdLeaf a>, '*', [<RdLeaf b>, '*', <MOstr x>, '+', <RdLeaf c>]]
"""
lfop = lookfor(is_operator)
operator_corout = partial(concurent_broadcast, lookfors=[lfop])