Feat: missing_times works with RdLeaf
This commit is contained in:
parent
91779bd945
commit
70ec6933ac
@ -15,7 +15,7 @@ from decimal import Decimal, InvalidOperation
|
|||||||
from .coroutine import *
|
from .coroutine import *
|
||||||
from .operator import is_operator
|
from .operator import is_operator
|
||||||
from .MO import moify_cor
|
from .MO import moify_cor
|
||||||
from .random.leaf import look_for_rdleaf
|
from .random.leaf import look_for_rdleaf, RdLeaf
|
||||||
|
|
||||||
__all__ = ["str2"]
|
__all__ = ["str2"]
|
||||||
|
|
||||||
@ -395,8 +395,10 @@ def missing_times(target):
|
|||||||
elif not is_operator(tok) and tok != ")":
|
elif not is_operator(tok) and tok != ")":
|
||||||
target_.send("*")
|
target_.send("*")
|
||||||
|
|
||||||
if isinstance(tok, int) or (
|
if (
|
||||||
isinstance(tok, str) and not is_operator(tok) and not tok == "("
|
isinstance(tok, int)
|
||||||
|
or (isinstance(tok, str) and not is_operator(tok) and not tok == "(")
|
||||||
|
or (isinstance(tok, RdLeaf))
|
||||||
):
|
):
|
||||||
previous = tok
|
previous = tok
|
||||||
|
|
||||||
@ -819,7 +821,7 @@ def rdstr2(sink):
|
|||||||
>>> rdstr2list("{a}+{a*b}-2")
|
>>> rdstr2list("{a}+{a*b}-2")
|
||||||
[<RdLeaf a>, '+', <RdLeaf a*b>, '+', <MOnumber - 2>]
|
[<RdLeaf a>, '+', <RdLeaf a*b>, '+', <MOnumber - 2>]
|
||||||
>>> rdstr2list("{a}({b}x+{c})")
|
>>> 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)
|
lfop = lookfor(is_operator)
|
||||||
operator_corout = partial(concurent_broadcast, lookfors=[lfop])
|
operator_corout = partial(concurent_broadcast, lookfors=[lfop])
|
||||||
|
Loading…
Reference in New Issue
Block a user