예제 #1
0
파일: parameter.py 프로젝트: uternet/pycket
def scheme_extend_parameterization(args):
    if len(args) == 0:
        raise SchemeException("extend-parameterization: expected 1 or more arguments")

    config = args[0]
    argc = len(args)

    if argc < 2 or not isinstance(config, values_parameter.W_Parameterization) or argc % 2 != 1:
        return config

    parser = ArgParser("extend-parameterization", args, start_at=1)
    while parser.has_more():
        param  = parser.parameter()
        key    = parser.object()
        config = config.extend([param], [key])

    return config
예제 #2
0
파일: parameter.py 프로젝트: cderici/pycket
def scheme_extend_parameterization(args):
    if len(args) == 0:
        raise SchemeException(
            "extend-parameterization: expected 1 or more arguments")

    config = args[0]
    argc = len(args)

    if argc < 2 or argc % 2 != 1:  # or not isinstance(config, values_parameter.W_Parameterization):
        return config

    parser = ArgParser("extend-parameterization", args, start_at=1)
    while parser.has_more():
        param = parser.expect(values_parameter.W_BaseParameter)
        key = parser.expect(values.W_Object)
        config = config.extend([param], [key])

    return config
예제 #3
0
def scheme_extend_parameterization(args, env, cont):
    from pycket.interpreter import return_value
    if len(args) == 0:
        raise SchemeException(
            "extend-parameterization: expected 1 or more arguments")

    config = args[0]
    argc = len(args)

    if argc < 2 or argc % 2 != 1:  # or not isinstance(config, values_parameter.W_Parameterization):
        return return_value(config, env, cont)

    parser = ArgParser("extend-parameterization", args, start_at=1)
    params = [None] * ((argc - 1) / 2)
    keys = [None] * ((argc - 1) / 2)
    i = 0
    while parser.has_more():
        params[i] = parser.expect(values_parameter.W_BaseParameter)
        keys[i] = parser.expect(values.W_Object)
        i += 1

    assert isinstance(config, values_parameter.W_Parameterization)
    return config.extend(params, keys, env, cont)
예제 #4
0
파일: parameter.py 프로젝트: pycket/pycket
def scheme_extend_parameterization(args, env, cont):
    from pycket.interpreter import return_value
    if len(args) == 0:
        raise SchemeException("extend-parameterization: expected 1 or more arguments")

    config = args[0]
    argc = len(args)

    if argc < 2 or argc % 2 != 1: # or not isinstance(config, values_parameter.W_Parameterization):
        return return_value(config, env, cont)


    parser = ArgParser("extend-parameterization", args, start_at=1)
    params = [None]*((argc-1)/2)
    keys = [None]*((argc-1)/2)
    i = 0
    while parser.has_more():
        params[i]  = parser.expect(values_parameter.W_BaseParameter)
        keys[i]    = parser.expect(values.W_Object)
        i += 1

    assert isinstance(config, values_parameter.W_Parameterization)
    return config.extend(params, keys, env, cont)