def ifx(argv): op, lb, val, rb, qualifier = argv[:5] if lb != '(' or rb != ')' or qualifier != 'do': raise SyntaxError op = op.lower() if not op in ('true', 'false', 'parse'): raise SyntaxError, 'invalid conditional operator' if op in ('true', 'false'): result = sv.bool(val) if op == 'false': result = not result else: del sv['_tempcoreesc'] es.set('_tempcoreesc', 0) es.mathparse('_tempcoreesc', val) result = sv._tempcoreesc stack.setcond(bool(result))
def mathparse(argv): del sv[argv[0]] es.mathparse(argv[0], argv[1])