cinap_lenrekadd hg and python4bb9e2215 years agoHistory
3202 lines · 110.8 KB · C
RawDownload
        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyIf(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int   col_offset, PyArena *arena){        stmt_ty p;        if (!test) {                PyErr_SetString(PyExc_ValueError,                                "field test is required for If");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = If_kind;        p->v.If.test = test;        p->v.If.body = body;        p->v.If.orelse = orelse;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyWith(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int lineno,     int col_offset, PyArena *arena){        stmt_ty p;        if (!context_expr) {                PyErr_SetString(PyExc_ValueError,                                "field context_expr is required for With");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = With_kind;        p->v.With.context_expr = context_expr;        p->v.With.optional_vars = optional_vars;        p->v.With.body = body;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyRaise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset,      PyArena *arena){        stmt_ty p;        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Raise_kind;        p->v.Raise.type = type;        p->v.Raise.inst = inst;        p->v.Raise.tback = tback;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyTryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno,          int col_offset, PyArena *arena){        stmt_ty p;        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = TryExcept_kind;        p->v.TryExcept.body = body;        p->v.TryExcept.handlers = handlers;        p->v.TryExcept.orelse = orelse;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyTryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset,           PyArena *arena){        stmt_ty p;        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = TryFinally_kind;        p->v.TryFinally.body = body;        p->v.TryFinally.finalbody = finalbody;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyAssert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena){        stmt_ty p;        if (!test) {                PyErr_SetString(PyExc_ValueError,                                "field test is required for Assert");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Assert_kind;        p->v.Assert.test = test;        p->v.Assert.msg = msg;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyImport(asdl_seq * names, int lineno, int col_offset, PyArena *arena){        stmt_ty p;        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Import_kind;        p->v.Import.names = names;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyImportFrom(identifier module, asdl_seq * names, int level, int lineno, int           col_offset, PyArena *arena){        stmt_ty p;        if (!module) {                PyErr_SetString(PyExc_ValueError,                                "field module is required for ImportFrom");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = ImportFrom_kind;        p->v.ImportFrom.module = module;        p->v.ImportFrom.names = names;        p->v.ImportFrom.level = level;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyExec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int col_offset,     PyArena *arena){        stmt_ty p;        if (!body) {                PyErr_SetString(PyExc_ValueError,                                "field body is required for Exec");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Exec_kind;        p->v.Exec.body = body;        p->v.Exec.globals = globals;        p->v.Exec.locals = locals;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyGlobal(asdl_seq * names, int lineno, int col_offset, PyArena *arena){        stmt_ty p;        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Global_kind;        p->v.Global.names = names;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyExpr(expr_ty value, int lineno, int col_offset, PyArena *arena){        stmt_ty p;        if (!value) {                PyErr_SetString(PyExc_ValueError,                                "field value is required for Expr");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Expr_kind;        p->v.Expr.value = value;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyPass(int lineno, int col_offset, PyArena *arena){        stmt_ty p;        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Pass_kind;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyBreak(int lineno, int col_offset, PyArena *arena){        stmt_ty p;        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Break_kind;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyContinue(int lineno, int col_offset, PyArena *arena){        stmt_ty p;        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Continue_kind;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyBoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena       *arena){        expr_ty p;        if (!op) {                PyErr_SetString(PyExc_ValueError,                                "field op is required for BoolOp");                return NULL;        }        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = BoolOp_kind;        p->v.BoolOp.op = op;        p->v.BoolOp.values = values;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyBinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset,      PyArena *arena){        expr_ty p;        if (!left) {                PyErr_SetString(PyExc_ValueError,                                "field left is required for BinOp");                return NULL;        }        if (!op) {                PyErr_SetString(PyExc_ValueError,                                "field op is required for BinOp");                return NULL;        }        if (!right) {                PyErr_SetString(PyExc_ValueError,                                "field right is required for BinOp");                return NULL;        }        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = BinOp_kind;        p->v.BinOp.left = left;        p->v.BinOp.op = op;        p->v.BinOp.right = right;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyUnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena        *arena){        expr_ty p;        if (!op) {                PyErr_SetString(PyExc_ValueError,                                "field op is required for UnaryOp");                return NULL;        }        if (!operand) {                PyErr_SetString(PyExc_ValueError,                                "field operand is required for UnaryOp");                return NULL;        }        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = UnaryOp_kind;        p->v.UnaryOp.op = op;        p->v.UnaryOp.operand = operand;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyLambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena       *arena){        expr_ty p;        if (!args) {                PyErr_SetString(PyExc_ValueError,                                "field args is required for Lambda");                return NULL;        }        if (!body) {                PyErr_SetString(PyExc_ValueError,                                "field body is required for Lambda");                return NULL;        }        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Lambda_kind;        p->v.Lambda.args = args;        p->v.Lambda.body = body;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyIfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset,      PyArena *arena){        expr_ty p;        if (!test) {                PyErr_SetString(PyExc_ValueError,                                "field test is required for IfExp");                return NULL;        }        if (!body) {                PyErr_SetString(PyExc_ValueError,                                "field body is required for IfExp");                return NULL;        }        if (!orelse) {                PyErr_SetString(PyExc_ValueError,                                "field orelse is required for IfExp");                return NULL;        }        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = IfExp_kind;        p->v.IfExp.test = test;        p->v.IfExp.body = body;        p->v.IfExp.orelse = orelse;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyDict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena     *arena){        expr_ty p;        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Dict_kind;        p->v.Dict.keys = keys;        p->v.Dict.values = values;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,         PyArena *arena){        expr_ty p;        if (!elt) {                PyErr_SetString(PyExc_ValueError,                                "field elt is required for ListComp");                return NULL;        }        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = ListComp_kind;        p->v.ListComp.elt = elt;        p->v.ListComp.generators = generators;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyGeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,             PyArena *arena){        expr_ty p;        if (!elt) {                PyErr_SetString(PyExc_ValueError,                                "field elt is required for GeneratorExp");                return NULL;        }        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = GeneratorExp_kind;        p->v.GeneratorExp.elt = elt;        p->v.GeneratorExp.generators = generators;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} expr_tyYield(expr_ty value, int lineno, int col_offset, PyArena *arena){        expr_ty p;        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Yield_kind;        p->v.Yield.value = value;        p->lineno = lineno;

Lines 1001–1500 of 3202. Previous lines