예제 #1
0
def expression_runf(p):
    try:
        if (isinstance(function.getfunction(p[0].getstr()),
                       function.PycFunction)):
            INPFUNC_SPECIAL_1 = p
            OUTFUNC_SPECIAL_1 = None
            ldict = locals()
            exec(function.getfunction(p[0].getstr()).pyc, None, ldict)
            OUTFUNC_SPECIAL_1 = ldict['OUTFUNC_SPECIAL_1']
            return typed.returntype(OUTFUNC_SPECIAL_1)
        else:
            iterv = 1
            itervas = 1
            for i in function.getfunction(p[0].getstr()).args:
                variable.addvariable(
                    variable.Variable(i, variable.variabletypelist[0],
                                      p[itervas].evalv()))
                itervas += 1
            for i in function.getfunction(p[0].getstr()).code:
                if (len(function.getfunction(p[0].getstr()).code) != iterv):
                    parser.parsetxt(i)
                else:
                    return parser.parsetxtreturn(i)
                iterv += 1
            intervas = 1
            for i in function.getfunction(p[0].getstr()).args:
                variable.remvariable(i)
                itervas += 1
    except AttributeError:
        raise AttributeError('Unknown Function "{0}" at line {1}'.format(
            p[0].getstr(), parser.linenum))
예제 #2
0
def expression_addsmv(p):
    return typed.returntype((p[0].evalv() / 2))
예제 #3
0
def expression_multv(p):
    return typed.returntype((p[0].evalv() / p[2].evalv()))
예제 #4
0
def expression_subv(p):
    return typed.returntype((p[0].evalv() - p[2].evalv()))
예제 #5
0
def expression_addv(p):
    return typed.returntype((p[0].evalv() + p[2].evalv()))