Beispiel #1
0
def getEle(commd):
    etp = getType(commd)
    if etp in ['COMP','MAP','PIPE','IO LASSIGN', 'IO WRITE']:
       val, rest = None, cdr(commd)
    elif etp in ['LIST','BLOCK','DICT','STR']:
       (val,rest) = pytool.getFirstPareCont(commd, car(commd) ) 
    elif etp in ['IO RASSIGN','IO APPEND']:
       val, rest = None, cdr(cdr(commd))
    else:
       tmp = commd.split(' ', 1)   # tmp = [ C arg1 arg2 ..]
       val, rest = tmp[0].strip(), tmp[1:]
       rest = ''.join(rest)

    return (etp,val, rest.strip())
Beispiel #2
0
def funcCall(vals):
    assert(len(vals) > 0)
    func, args = car(vals), cdr(vals)
    if not hasattr(func,'__call__'):
        assert(len(args) == 0)
        return func
    else:
        return tryFuncCall(func, *args)