예제 #1
0
def SplitAllAfter(operand, ):
    splitall = util.Proxy()
    splitall.subject = (combine.GuardedChoice(
        SplitAfter(operand), congruent.Cons(base.ident,
                                            project.head * splitall),
        build.List((base.ident, ))))
    return splitall
예제 #2
0
def Foldr(tail, Cons, operand=None):
    if operand is None:
        operand = base.ident
    foldr = util.Proxy()
    foldr.subject = combine.GuardedChoice(
        match.nil, tail,
        Cons(combine.Composition(project.head, operand),
             combine.Composition(project.tail, foldr)))
    return foldr
예제 #3
0
파일: transformation.py 프로젝트: uxmal/idc
    def __pow__(self, other):
        '''Exponentiation operater. Shorthand for L{lib.combine.GuardedChoice}.

		For example, C{t1 **t2** t3} is equivalent, to C{lib.combine.GuardedChoice(t1, t2,
		t3)}. The exponentiation operator is right associative, so C{t1 **t2** t3
		**t4** t5} is the same as C{t1 **t2** (t3 **t4** t5)}. However note that its
		precedence is higher than other operators, therefore parenthesis must be used
		around them.

		@see: U{http://docs.python.org/ref/summary.html} for a summary of Python's
		operators precedence.
		'''
        #warnings.warn("using deprecated guarded choice operator", DeprecationWarning, stacklevel=2)
        from transf.lib import combine
        if isinstance(other, tuple):
            return combine.GuardedChoice(self, *other)
        else:
            return (self, other)
예제 #4
0
def _CountOne(operand):
    return combine.GuardedChoice(operand, build.one, build.zero)
예제 #5
0
파일: traverse.py 프로젝트: uxmal/idc
def Leaves(operand, isLeaf):
    return iterate.Rec(
        lambda self: combine.GuardedChoice(isLeaf, operand, All(self)))
예제 #6
0
파일: traverse.py 프로젝트: uxmal/idc
def ManyBU(operand):
    return iterate.Rec(lambda self: combine.GuardedChoice(
        Some(self), combine.Try(operand), operand))
예제 #7
0
파일: traverse.py 프로젝트: uxmal/idc
def ManyTD(operand):
    return iterate.Rec(lambda self: combine.GuardedChoice(
        operand, All(combine.Try(self)), Some(self)))