示例#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 SplitBefore(operand):
    tail = types.term.Term('tail')
    return scope.Scope(
        (tail, ),
        build.List((AtSuffix(
            congruent.Cons(operand, base.ident) * match.Var(tail) * build.nil),
                    build.Var(tail))))
示例#3
0
def SplitKeep(operand):
    elem = types.term.Term('elem')
    tail = types.term.Term('tail')
    return scope.Scope(
        (elem, tail),
        build.List((AtSuffix(
            match.Cons(operand * match.Var(elem), match.Var(tail)) *
            build.nil), build.Var(elem), build.Var(tail))))
示例#4
0
def SplitAfter(operand):
    tail = types.term.Term('tail')
    return scope.Scope(
        (tail, ),
        build.List(
            (AtSuffix(congruent.Cons(operand,
                                     match.Var(tail) * build.nil)),
             build.Var(tail))))