示例#1
0
文件: control.py 项目: uternet/pycket
def call_with_continuation_prompt(args, env, cont):
    if len(args) < 1:
        raise SchemeException("call-with-continuation-prompt: not given enough values")
    parser  = ArgParser("call-with-continuation-prompt", args)
    tag     = values.w_default_continuation_prompt_tag
    handler = default_continuation_prompt_handler
    fun     = parser.object()

    try:
        tag     = parser.prompt_tag()
        handler = parser.object()
    except EndOfInput:
        pass

    args = parser._object()
    if not fun.iscallable():
        raise SchemeException("call-with-continuation-prompt: not given callable function")
    if not handler.iscallable():
        raise SchemeException("call-with-continuation-prompt: not given callable handler")
    cont = Prompt(tag, handler, env, cont)
    return fun.call(args, env, cont)
示例#2
0
def call_with_continuation_prompt(args, env, cont):
    if len(args) < 1:
        raise SchemeException(
            "call-with-continuation-prompt: not given enough values")
    parser = ArgParser("call-with-continuation-prompt", args)
    tag = values.w_default_continuation_prompt_tag
    handler = default_continuation_prompt_handler
    fun = parser.object()

    try:
        tag = parser.prompt_tag()
        handler = parser.object()
    except EndOfInput:
        pass

    args = parser._object()
    if not fun.iscallable():
        raise SchemeException(
            "call-with-continuation-prompt: not given callable function")
    if not handler.iscallable():
        raise SchemeException(
            "call-with-continuation-prompt: not given callable handler")
    cont = Prompt(tag, handler, env, cont)
    return fun.call(args, env, cont)