cinap_lenrekadd hg and python4bb9e2215 years agoHistory
3202 lines · 110.8 KB · C
RawDownload
        Expr_type = make_type("Expr", stmt_type, Expr_fields, 1);        if (!Expr_type) return 0;        Pass_type = make_type("Pass", stmt_type, NULL, 0);        if (!Pass_type) return 0;        Break_type = make_type("Break", stmt_type, NULL, 0);        if (!Break_type) return 0;        Continue_type = make_type("Continue", stmt_type, NULL, 0);        if (!Continue_type) return 0;        expr_type = make_type("expr", AST_type, NULL, 0);        if (!expr_type) return 0;        if (!add_attributes(expr_type, expr_attributes, 2)) return 0;        BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2);        if (!BoolOp_type) return 0;        BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3);        if (!BinOp_type) return 0;        UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2);        if (!UnaryOp_type) return 0;        Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2);        if (!Lambda_type) return 0;        IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3);        if (!IfExp_type) return 0;        Dict_type = make_type("Dict", expr_type, Dict_fields, 2);        if (!Dict_type) return 0;        ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2);        if (!ListComp_type) return 0;        GeneratorExp_type = make_type("GeneratorExp", expr_type,                                      GeneratorExp_fields, 2);        if (!GeneratorExp_type) return 0;        Yield_type = make_type("Yield", expr_type, Yield_fields, 1);        if (!Yield_type) return 0;        Compare_type = make_type("Compare", expr_type, Compare_fields, 3);        if (!Compare_type) return 0;        Call_type = make_type("Call", expr_type, Call_fields, 5);        if (!Call_type) return 0;        Repr_type = make_type("Repr", expr_type, Repr_fields, 1);        if (!Repr_type) return 0;        Num_type = make_type("Num", expr_type, Num_fields, 1);        if (!Num_type) return 0;        Str_type = make_type("Str", expr_type, Str_fields, 1);        if (!Str_type) return 0;        Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3);        if (!Attribute_type) return 0;        Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3);        if (!Subscript_type) return 0;        Name_type = make_type("Name", expr_type, Name_fields, 2);        if (!Name_type) return 0;        List_type = make_type("List", expr_type, List_fields, 2);        if (!List_type) return 0;        Tuple_type = make_type("Tuple", expr_type, Tuple_fields, 2);        if (!Tuple_type) return 0;        expr_context_type = make_type("expr_context", AST_type, NULL, 0);        if (!expr_context_type) return 0;        if (!add_attributes(expr_context_type, NULL, 0)) return 0;        Load_type = make_type("Load", expr_context_type, NULL, 0);        if (!Load_type) return 0;        Load_singleton = PyType_GenericNew(Load_type, NULL, NULL);        if (!Load_singleton) return 0;        Store_type = make_type("Store", expr_context_type, NULL, 0);        if (!Store_type) return 0;        Store_singleton = PyType_GenericNew(Store_type, NULL, NULL);        if (!Store_singleton) return 0;        Del_type = make_type("Del", expr_context_type, NULL, 0);        if (!Del_type) return 0;        Del_singleton = PyType_GenericNew(Del_type, NULL, NULL);        if (!Del_singleton) return 0;        AugLoad_type = make_type("AugLoad", expr_context_type, NULL, 0);        if (!AugLoad_type) return 0;        AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL);        if (!AugLoad_singleton) return 0;        AugStore_type = make_type("AugStore", expr_context_type, NULL, 0);        if (!AugStore_type) return 0;        AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL);        if (!AugStore_singleton) return 0;        Param_type = make_type("Param", expr_context_type, NULL, 0);        if (!Param_type) return 0;        Param_singleton = PyType_GenericNew(Param_type, NULL, NULL);        if (!Param_singleton) return 0;        slice_type = make_type("slice", AST_type, NULL, 0);        if (!slice_type) return 0;        if (!add_attributes(slice_type, NULL, 0)) return 0;        Ellipsis_type = make_type("Ellipsis", slice_type, NULL, 0);        if (!Ellipsis_type) return 0;        Slice_type = make_type("Slice", slice_type, Slice_fields, 3);        if (!Slice_type) return 0;        ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1);        if (!ExtSlice_type) return 0;        Index_type = make_type("Index", slice_type, Index_fields, 1);        if (!Index_type) return 0;        boolop_type = make_type("boolop", AST_type, NULL, 0);        if (!boolop_type) return 0;        if (!add_attributes(boolop_type, NULL, 0)) return 0;        And_type = make_type("And", boolop_type, NULL, 0);        if (!And_type) return 0;        And_singleton = PyType_GenericNew(And_type, NULL, NULL);        if (!And_singleton) return 0;        Or_type = make_type("Or", boolop_type, NULL, 0);        if (!Or_type) return 0;        Or_singleton = PyType_GenericNew(Or_type, NULL, NULL);        if (!Or_singleton) return 0;        operator_type = make_type("operator", AST_type, NULL, 0);        if (!operator_type) return 0;        if (!add_attributes(operator_type, NULL, 0)) return 0;        Add_type = make_type("Add", operator_type, NULL, 0);        if (!Add_type) return 0;        Add_singleton = PyType_GenericNew(Add_type, NULL, NULL);        if (!Add_singleton) return 0;        Sub_type = make_type("Sub", operator_type, NULL, 0);        if (!Sub_type) return 0;        Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL);        if (!Sub_singleton) return 0;        Mult_type = make_type("Mult", operator_type, NULL, 0);        if (!Mult_type) return 0;        Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL);        if (!Mult_singleton) return 0;        Div_type = make_type("Div", operator_type, NULL, 0);        if (!Div_type) return 0;        Div_singleton = PyType_GenericNew(Div_type, NULL, NULL);        if (!Div_singleton) return 0;        Mod_type = make_type("Mod", operator_type, NULL, 0);        if (!Mod_type) return 0;        Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL);        if (!Mod_singleton) return 0;        Pow_type = make_type("Pow", operator_type, NULL, 0);        if (!Pow_type) return 0;        Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL);        if (!Pow_singleton) return 0;        LShift_type = make_type("LShift", operator_type, NULL, 0);        if (!LShift_type) return 0;        LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL);        if (!LShift_singleton) return 0;        RShift_type = make_type("RShift", operator_type, NULL, 0);        if (!RShift_type) return 0;        RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL);        if (!RShift_singleton) return 0;        BitOr_type = make_type("BitOr", operator_type, NULL, 0);        if (!BitOr_type) return 0;        BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL);        if (!BitOr_singleton) return 0;        BitXor_type = make_type("BitXor", operator_type, NULL, 0);        if (!BitXor_type) return 0;        BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL);        if (!BitXor_singleton) return 0;        BitAnd_type = make_type("BitAnd", operator_type, NULL, 0);        if (!BitAnd_type) return 0;        BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL);        if (!BitAnd_singleton) return 0;        FloorDiv_type = make_type("FloorDiv", operator_type, NULL, 0);        if (!FloorDiv_type) return 0;        FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL);        if (!FloorDiv_singleton) return 0;        unaryop_type = make_type("unaryop", AST_type, NULL, 0);        if (!unaryop_type) return 0;        if (!add_attributes(unaryop_type, NULL, 0)) return 0;        Invert_type = make_type("Invert", unaryop_type, NULL, 0);        if (!Invert_type) return 0;        Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL);        if (!Invert_singleton) return 0;        Not_type = make_type("Not", unaryop_type, NULL, 0);        if (!Not_type) return 0;        Not_singleton = PyType_GenericNew(Not_type, NULL, NULL);        if (!Not_singleton) return 0;        UAdd_type = make_type("UAdd", unaryop_type, NULL, 0);        if (!UAdd_type) return 0;        UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL);        if (!UAdd_singleton) return 0;        USub_type = make_type("USub", unaryop_type, NULL, 0);        if (!USub_type) return 0;        USub_singleton = PyType_GenericNew(USub_type, NULL, NULL);        if (!USub_singleton) return 0;        cmpop_type = make_type("cmpop", AST_type, NULL, 0);        if (!cmpop_type) return 0;        if (!add_attributes(cmpop_type, NULL, 0)) return 0;        Eq_type = make_type("Eq", cmpop_type, NULL, 0);        if (!Eq_type) return 0;        Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL);        if (!Eq_singleton) return 0;        NotEq_type = make_type("NotEq", cmpop_type, NULL, 0);        if (!NotEq_type) return 0;        NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL);        if (!NotEq_singleton) return 0;        Lt_type = make_type("Lt", cmpop_type, NULL, 0);        if (!Lt_type) return 0;        Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL);        if (!Lt_singleton) return 0;        LtE_type = make_type("LtE", cmpop_type, NULL, 0);        if (!LtE_type) return 0;        LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL);        if (!LtE_singleton) return 0;        Gt_type = make_type("Gt", cmpop_type, NULL, 0);        if (!Gt_type) return 0;        Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL);        if (!Gt_singleton) return 0;        GtE_type = make_type("GtE", cmpop_type, NULL, 0);        if (!GtE_type) return 0;        GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL);        if (!GtE_singleton) return 0;        Is_type = make_type("Is", cmpop_type, NULL, 0);        if (!Is_type) return 0;        Is_singleton = PyType_GenericNew(Is_type, NULL, NULL);        if (!Is_singleton) return 0;        IsNot_type = make_type("IsNot", cmpop_type, NULL, 0);        if (!IsNot_type) return 0;        IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL);        if (!IsNot_singleton) return 0;        In_type = make_type("In", cmpop_type, NULL, 0);        if (!In_type) return 0;        In_singleton = PyType_GenericNew(In_type, NULL, NULL);        if (!In_singleton) return 0;        NotIn_type = make_type("NotIn", cmpop_type, NULL, 0);        if (!NotIn_type) return 0;        NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL);        if (!NotIn_singleton) return 0;        comprehension_type = make_type("comprehension", AST_type,                                       comprehension_fields, 3);        if (!comprehension_type) return 0;        excepthandler_type = make_type("excepthandler", AST_type,                                       excepthandler_fields, 5);        if (!excepthandler_type) return 0;        arguments_type = make_type("arguments", AST_type, arguments_fields, 4);        if (!arguments_type) return 0;        keyword_type = make_type("keyword", AST_type, keyword_fields, 2);        if (!keyword_type) return 0;        alias_type = make_type("alias", AST_type, alias_fields, 2);        if (!alias_type) return 0;        initialized = 1;        return 1;} mod_tyModule(asdl_seq * body, PyArena *arena){        mod_ty p;        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Module_kind;        p->v.Module.body = body;        return p;} mod_tyInteractive(asdl_seq * body, PyArena *arena){        mod_ty p;        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Interactive_kind;        p->v.Interactive.body = body;        return p;} mod_tyExpression(expr_ty body, PyArena *arena){        mod_ty p;        if (!body) {                PyErr_SetString(PyExc_ValueError,                                "field body is required for Expression");                return NULL;        }        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Expression_kind;        p->v.Expression.body = body;        return p;} mod_tySuite(asdl_seq * body, PyArena *arena){        mod_ty p;        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Suite_kind;        p->v.Suite.body = body;        return p;} stmt_tyFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *            decorators, int lineno, int col_offset, PyArena *arena){        stmt_ty p;        if (!name) {                PyErr_SetString(PyExc_ValueError,                                "field name is required for FunctionDef");                return NULL;        }        if (!args) {                PyErr_SetString(PyExc_ValueError,                                "field args is required for FunctionDef");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = FunctionDef_kind;        p->v.FunctionDef.name = name;        p->v.FunctionDef.args = args;        p->v.FunctionDef.body = body;        p->v.FunctionDef.decorators = decorators;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int lineno, int         col_offset, PyArena *arena){        stmt_ty p;        if (!name) {                PyErr_SetString(PyExc_ValueError,                                "field name is required for ClassDef");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = ClassDef_kind;        p->v.ClassDef.name = name;        p->v.ClassDef.bases = bases;        p->v.ClassDef.body = body;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyReturn(expr_ty value, 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 = Return_kind;        p->v.Return.value = value;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyDelete(asdl_seq * targets, 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 = Delete_kind;        p->v.Delete.targets = targets;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyAssign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, PyArena       *arena){        stmt_ty p;        if (!value) {                PyErr_SetString(PyExc_ValueError,                                "field value is required for Assign");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = Assign_kind;        p->v.Assign.targets = targets;        p->v.Assign.value = value;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyAugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int          col_offset, PyArena *arena){        stmt_ty p;        if (!target) {                PyErr_SetString(PyExc_ValueError,                                "field target is required for AugAssign");                return NULL;        }        if (!op) {                PyErr_SetString(PyExc_ValueError,                                "field op is required for AugAssign");                return NULL;        }        if (!value) {                PyErr_SetString(PyExc_ValueError,                                "field value is required for AugAssign");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = AugAssign_kind;        p->v.AugAssign.target = target;        p->v.AugAssign.op = op;        p->v.AugAssign.value = value;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyPrint(expr_ty dest, asdl_seq * values, bool nl, 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 = Print_kind;        p->v.Print.dest = dest;        p->v.Print.values = values;        p->v.Print.nl = nl;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int    lineno, int col_offset, PyArena *arena){        stmt_ty p;        if (!target) {                PyErr_SetString(PyExc_ValueError,                                "field target is required for For");                return NULL;        }        if (!iter) {                PyErr_SetString(PyExc_ValueError,                                "field iter is required for For");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = For_kind;        p->v.For.target = target;        p->v.For.iter = iter;        p->v.For.body = body;        p->v.For.orelse = orelse;        p->lineno = lineno;        p->col_offset = col_offset;        return p;} stmt_tyWhile(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 While");                return NULL;        }        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));        if (!p) {                PyErr_NoMemory();                return NULL;        }        p->kind = While_kind;        p->v.While.test = test;        p->v.While.body = body;        p->v.While.orelse = orelse;

Lines 501–1000 of 3202. Previous lines