Created
October 6, 2015 01:39
-
-
Save aisk/24a3071fa2e4a0e1e47e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // generated by asdl_pyston.py | |
| #include <algorithm> | |
| #include <cmath> | |
| #include <langinfo.h> | |
| #include <sstream> | |
| #include "llvm/Support/FileSystem.h" | |
| #include "llvm/Support/Path.h" | |
| #include "codegen/unwinding.h" | |
| #include "core/ast.h" | |
| #include "core/types.h" | |
| #include "runtime/file.h" | |
| #include "runtime/inline/boxing.h" | |
| #include "runtime/int.h" | |
| #include "runtime/types.h" | |
| #include "runtime/util.h" | |
| namespace pyston { | |
| static BoxedClass* AST_cls; | |
| class BoxedAST : public Box { | |
| public: | |
| AST* ast; | |
| BoxedAST(){}; | |
| }; | |
| static std::unordered_map<int, BoxedClass*> type_to_cls; | |
| Box* boxAst(AST* ast) { | |
| assert(ast); | |
| BoxedClass* cls = type_to_cls[ast->type]; | |
| assert(cls); | |
| BoxedAST* rtn = new (cls) BoxedAST(); | |
| assert(rtn->cls == cls); | |
| rtn->ast = ast; | |
| return rtn; | |
| } | |
| AST* unboxAst(Box* b) { | |
| assert(isSubclass(b->cls, AST_cls)); | |
| AST* rtn = static_cast<BoxedAST*>(b)->ast; | |
| assert(rtn); | |
| return rtn; | |
| } | |
| extern "C" int PyAST_Check(PyObject* o) noexcept { | |
| return isSubclass(o->cls, AST_cls); | |
| } | |
| // __init__ function for Module | |
| Box* ModuleInit(BoxedAST* self, Box* body) { | |
| PyAST_Check(self); | |
| self->giveAttr("body", body); | |
| return None; | |
| } | |
| // __init__ function for Interactive | |
| Box* InteractiveInit(BoxedAST* self, Box* body) { | |
| PyAST_Check(self); | |
| self->giveAttr("body", body); | |
| return None; | |
| } | |
| // __init__ function for Expression | |
| Box* ExpressionInit(BoxedAST* self, Box* body) { | |
| PyAST_Check(self); | |
| self->giveAttr("body", body); | |
| return None; | |
| } | |
| // __init__ function for Suite | |
| Box* SuiteInit(BoxedAST* self, Box* body) { | |
| PyAST_Check(self); | |
| self->giveAttr("body", body); | |
| return None; | |
| } | |
| // __init__ function for FunctionDef | |
| Box* FunctionDefInit(BoxedAST* self, Box* name, Box* args, Box** _args) { | |
| PyAST_Check(self); | |
| Box* body = _args[0]; | |
| Box* decorator_list = _args[1]; | |
| self->giveAttr("name", name); | |
| self->giveAttr("args", args); | |
| self->giveAttr("body", body); | |
| self->giveAttr("decorator_list", decorator_list); | |
| return None; | |
| } | |
| // __init__ function for ClassDef | |
| Box* ClassDefInit(BoxedAST* self, Box* name, Box* bases, Box** _args) { | |
| PyAST_Check(self); | |
| Box* body = _args[0]; | |
| Box* decorator_list = _args[1]; | |
| self->giveAttr("name", name); | |
| self->giveAttr("bases", bases); | |
| self->giveAttr("body", body); | |
| self->giveAttr("decorator_list", decorator_list); | |
| return None; | |
| } | |
| // __init__ function for Return | |
| Box* ReturnInit(BoxedAST* self, Box* value) { | |
| PyAST_Check(self); | |
| self->giveAttr("value", value); | |
| return None; | |
| } | |
| // __init__ function for Delete | |
| Box* DeleteInit(BoxedAST* self, Box* targets) { | |
| PyAST_Check(self); | |
| self->giveAttr("targets", targets); | |
| return None; | |
| } | |
| // __init__ function for Assign | |
| Box* AssignInit(BoxedAST* self, Box* targets, Box* value) { | |
| PyAST_Check(self); | |
| self->giveAttr("targets", targets); | |
| self->giveAttr("value", value); | |
| return None; | |
| } | |
| // __init__ function for AugAssign | |
| Box* AugAssignInit(BoxedAST* self, Box* target, Box* op, Box** _args) { | |
| PyAST_Check(self); | |
| Box* value = _args[0]; | |
| self->giveAttr("target", target); | |
| self->giveAttr("op", op); | |
| self->giveAttr("value", value); | |
| return None; | |
| } | |
| // __init__ function for Print | |
| Box* PrintInit(BoxedAST* self, Box* dest, Box* values, Box** _args) { | |
| PyAST_Check(self); | |
| Box* nl = _args[0]; | |
| self->giveAttr("dest", dest); | |
| self->giveAttr("values", values); | |
| self->giveAttr("nl", nl); | |
| return None; | |
| } | |
| // __init__ function for For | |
| Box* ForInit(BoxedAST* self, Box* target, Box* iter, Box** _args) { | |
| PyAST_Check(self); | |
| Box* body = _args[0]; | |
| Box* orelse = _args[1]; | |
| self->giveAttr("target", target); | |
| self->giveAttr("iter", iter); | |
| self->giveAttr("body", body); | |
| self->giveAttr("orelse", orelse); | |
| return None; | |
| } | |
| // __init__ function for While | |
| Box* WhileInit(BoxedAST* self, Box* test, Box* body, Box** _args) { | |
| PyAST_Check(self); | |
| Box* orelse = _args[0]; | |
| self->giveAttr("test", test); | |
| self->giveAttr("body", body); | |
| self->giveAttr("orelse", orelse); | |
| return None; | |
| } | |
| // __init__ function for If | |
| Box* IfInit(BoxedAST* self, Box* test, Box* body, Box** _args) { | |
| PyAST_Check(self); | |
| Box* orelse = _args[0]; | |
| self->giveAttr("test", test); | |
| self->giveAttr("body", body); | |
| self->giveAttr("orelse", orelse); | |
| return None; | |
| } | |
| // __init__ function for With | |
| Box* WithInit(BoxedAST* self, Box* context_expr, Box* optional_vars, Box** _args) { | |
| PyAST_Check(self); | |
| Box* body = _args[0]; | |
| self->giveAttr("context_expr", context_expr); | |
| self->giveAttr("optional_vars", optional_vars); | |
| self->giveAttr("body", body); | |
| return None; | |
| } | |
| // __init__ function for Raise | |
| Box* RaiseInit(BoxedAST* self, Box* type, Box* inst, Box** _args) { | |
| PyAST_Check(self); | |
| Box* tback = _args[0]; | |
| self->giveAttr("type", type); | |
| self->giveAttr("inst", inst); | |
| self->giveAttr("tback", tback); | |
| return None; | |
| } | |
| // __init__ function for TryExcept | |
| Box* TryExceptInit(BoxedAST* self, Box* body, Box* handlers, Box** _args) { | |
| PyAST_Check(self); | |
| Box* orelse = _args[0]; | |
| self->giveAttr("body", body); | |
| self->giveAttr("handlers", handlers); | |
| self->giveAttr("orelse", orelse); | |
| return None; | |
| } | |
| // __init__ function for TryFinally | |
| Box* TryFinallyInit(BoxedAST* self, Box* body, Box* finalbody) { | |
| PyAST_Check(self); | |
| self->giveAttr("body", body); | |
| self->giveAttr("finalbody", finalbody); | |
| return None; | |
| } | |
| // __init__ function for Assert | |
| Box* AssertInit(BoxedAST* self, Box* test, Box* msg) { | |
| PyAST_Check(self); | |
| self->giveAttr("test", test); | |
| self->giveAttr("msg", msg); | |
| return None; | |
| } | |
| // __init__ function for Import | |
| Box* ImportInit(BoxedAST* self, Box* names) { | |
| PyAST_Check(self); | |
| self->giveAttr("names", names); | |
| return None; | |
| } | |
| // __init__ function for ImportFrom | |
| Box* ImportFromInit(BoxedAST* self, Box* module, Box* names, Box** _args) { | |
| PyAST_Check(self); | |
| Box* level = _args[0]; | |
| self->giveAttr("module", module); | |
| self->giveAttr("names", names); | |
| self->giveAttr("level", level); | |
| return None; | |
| } | |
| // __init__ function for Exec | |
| Box* ExecInit(BoxedAST* self, Box* body, Box* globals, Box** _args) { | |
| PyAST_Check(self); | |
| Box* locals = _args[0]; | |
| self->giveAttr("body", body); | |
| self->giveAttr("globals", globals); | |
| self->giveAttr("locals", locals); | |
| return None; | |
| } | |
| // __init__ function for Global | |
| Box* GlobalInit(BoxedAST* self, Box* names) { | |
| PyAST_Check(self); | |
| self->giveAttr("names", names); | |
| return None; | |
| } | |
| // __init__ function for Expr | |
| Box* ExprInit(BoxedAST* self, Box* value) { | |
| PyAST_Check(self); | |
| self->giveAttr("value", value); | |
| return None; | |
| } | |
| // __init__ function for BoolOp | |
| Box* BoolOpInit(BoxedAST* self, Box* op, Box* values) { | |
| PyAST_Check(self); | |
| self->giveAttr("op", op); | |
| self->giveAttr("values", values); | |
| return None; | |
| } | |
| // __init__ function for BinOp | |
| Box* BinOpInit(BoxedAST* self, Box* left, Box* op, Box** _args) { | |
| PyAST_Check(self); | |
| Box* right = _args[0]; | |
| self->giveAttr("left", left); | |
| self->giveAttr("op", op); | |
| self->giveAttr("right", right); | |
| return None; | |
| } | |
| // __init__ function for UnaryOp | |
| Box* UnaryOpInit(BoxedAST* self, Box* op, Box* operand) { | |
| PyAST_Check(self); | |
| self->giveAttr("op", op); | |
| self->giveAttr("operand", operand); | |
| return None; | |
| } | |
| // __init__ function for Lambda | |
| Box* LambdaInit(BoxedAST* self, Box* args, Box* body) { | |
| PyAST_Check(self); | |
| self->giveAttr("args", args); | |
| self->giveAttr("body", body); | |
| return None; | |
| } | |
| // __init__ function for IfExp | |
| Box* IfExpInit(BoxedAST* self, Box* test, Box* body, Box** _args) { | |
| PyAST_Check(self); | |
| Box* orelse = _args[0]; | |
| self->giveAttr("test", test); | |
| self->giveAttr("body", body); | |
| self->giveAttr("orelse", orelse); | |
| return None; | |
| } | |
| // __init__ function for Dict | |
| Box* DictInit(BoxedAST* self, Box* keys, Box* values) { | |
| PyAST_Check(self); | |
| self->giveAttr("keys", keys); | |
| self->giveAttr("values", values); | |
| return None; | |
| } | |
| // __init__ function for Set | |
| Box* SetInit(BoxedAST* self, Box* elts) { | |
| PyAST_Check(self); | |
| self->giveAttr("elts", elts); | |
| return None; | |
| } | |
| // __init__ function for ListComp | |
| Box* ListCompInit(BoxedAST* self, Box* elt, Box* generators) { | |
| PyAST_Check(self); | |
| self->giveAttr("elt", elt); | |
| self->giveAttr("generators", generators); | |
| return None; | |
| } | |
| // __init__ function for SetComp | |
| Box* SetCompInit(BoxedAST* self, Box* elt, Box* generators) { | |
| PyAST_Check(self); | |
| self->giveAttr("elt", elt); | |
| self->giveAttr("generators", generators); | |
| return None; | |
| } | |
| // __init__ function for DictComp | |
| Box* DictCompInit(BoxedAST* self, Box* key, Box* value, Box** _args) { | |
| PyAST_Check(self); | |
| Box* generators = _args[0]; | |
| self->giveAttr("key", key); | |
| self->giveAttr("value", value); | |
| self->giveAttr("generators", generators); | |
| return None; | |
| } | |
| // __init__ function for GeneratorExp | |
| Box* GeneratorExpInit(BoxedAST* self, Box* elt, Box* generators) { | |
| PyAST_Check(self); | |
| self->giveAttr("elt", elt); | |
| self->giveAttr("generators", generators); | |
| return None; | |
| } | |
| // __init__ function for Yield | |
| Box* YieldInit(BoxedAST* self, Box* value) { | |
| PyAST_Check(self); | |
| self->giveAttr("value", value); | |
| return None; | |
| } | |
| // __init__ function for Compare | |
| Box* CompareInit(BoxedAST* self, Box* left, Box* ops, Box** _args) { | |
| PyAST_Check(self); | |
| Box* comparators = _args[0]; | |
| self->giveAttr("left", left); | |
| self->giveAttr("ops", ops); | |
| self->giveAttr("comparators", comparators); | |
| return None; | |
| } | |
| // __init__ function for Call | |
| Box* CallInit(BoxedAST* self, Box* func, Box* args, Box** _args) { | |
| PyAST_Check(self); | |
| Box* keywords = _args[0]; | |
| Box* starargs = _args[1]; | |
| Box* kwargs = _args[2]; | |
| self->giveAttr("func", func); | |
| self->giveAttr("args", args); | |
| self->giveAttr("keywords", keywords); | |
| self->giveAttr("starargs", starargs); | |
| self->giveAttr("kwargs", kwargs); | |
| return None; | |
| } | |
| // __init__ function for Repr | |
| Box* ReprInit(BoxedAST* self, Box* value) { | |
| PyAST_Check(self); | |
| self->giveAttr("value", value); | |
| return None; | |
| } | |
| // __init__ function for Num | |
| Box* NumInit(BoxedAST* self, Box* n) { | |
| PyAST_Check(self); | |
| self->giveAttr("n", n); | |
| return None; | |
| } | |
| // __init__ function for Str | |
| Box* StrInit(BoxedAST* self, Box* s) { | |
| PyAST_Check(self); | |
| self->giveAttr("s", s); | |
| return None; | |
| } | |
| // __init__ function for Attribute | |
| Box* AttributeInit(BoxedAST* self, Box* value, Box* attr, Box** _args) { | |
| PyAST_Check(self); | |
| Box* ctx = _args[0]; | |
| self->giveAttr("value", value); | |
| self->giveAttr("attr", attr); | |
| self->giveAttr("ctx", ctx); | |
| return None; | |
| } | |
| // __init__ function for Subscript | |
| Box* SubscriptInit(BoxedAST* self, Box* value, Box* slice, Box** _args) { | |
| PyAST_Check(self); | |
| Box* ctx = _args[0]; | |
| self->giveAttr("value", value); | |
| self->giveAttr("slice", slice); | |
| self->giveAttr("ctx", ctx); | |
| return None; | |
| } | |
| // __init__ function for Name | |
| Box* NameInit(BoxedAST* self, Box* id, Box* ctx) { | |
| PyAST_Check(self); | |
| self->giveAttr("id", id); | |
| self->giveAttr("ctx", ctx); | |
| return None; | |
| } | |
| // __init__ function for List | |
| Box* ListInit(BoxedAST* self, Box* elts, Box* ctx) { | |
| PyAST_Check(self); | |
| self->giveAttr("elts", elts); | |
| self->giveAttr("ctx", ctx); | |
| return None; | |
| } | |
| // __init__ function for Tuple | |
| Box* TupleInit(BoxedAST* self, Box* elts, Box* ctx) { | |
| PyAST_Check(self); | |
| self->giveAttr("elts", elts); | |
| self->giveAttr("ctx", ctx); | |
| return None; | |
| } | |
| // __init__ function for Slice | |
| Box* SliceInit(BoxedAST* self, Box* lower, Box* upper, Box** _args) { | |
| PyAST_Check(self); | |
| Box* step = _args[0]; | |
| self->giveAttr("lower", lower); | |
| self->giveAttr("upper", upper); | |
| self->giveAttr("step", step); | |
| return None; | |
| } | |
| // __init__ function for ExtSlice | |
| Box* ExtSliceInit(BoxedAST* self, Box* dims) { | |
| PyAST_Check(self); | |
| self->giveAttr("dims", dims); | |
| return None; | |
| } | |
| // __init__ function for Index | |
| Box* IndexInit(BoxedAST* self, Box* value) { | |
| PyAST_Check(self); | |
| self->giveAttr("value", value); | |
| return None; | |
| } | |
| // __init__ function for comprehension | |
| Box* comprehensionInit(BoxedAST* self, Box* target, Box* iter, Box** _args) { | |
| // PyAST_Check(self); | |
| Box* ifs = _args[0]; | |
| self->giveAttr("target", target); | |
| self->giveAttr("iter", iter); | |
| self->giveAttr("ifs", ifs); | |
| return None; | |
| } | |
| // __init__ function for ExceptHandler | |
| Box* ExceptHandlerInit(BoxedAST* self, Box* type, Box* name, Box** _args) { | |
| PyAST_Check(self); | |
| Box* body = _args[0]; | |
| self->giveAttr("type", type); | |
| self->giveAttr("name", name); | |
| self->giveAttr("body", body); | |
| return None; | |
| } | |
| // __init__ function for arguments | |
| Box* argumentsInit(BoxedAST* self, Box* args, Box* vararg, Box** _args) { | |
| // PyAST_Check(self); | |
| Box* kwarg = _args[0]; | |
| Box* defaults = _args[1]; | |
| self->giveAttr("args", args); | |
| self->giveAttr("vararg", vararg); | |
| self->giveAttr("kwarg", kwarg); | |
| self->giveAttr("defaults", defaults); | |
| return None; | |
| } | |
| // __init__ function for keyword | |
| Box* keywordInit(BoxedAST* self, Box* arg, Box* value) { | |
| // PyAST_Check(self); | |
| self->giveAttr("arg", arg); | |
| self->giveAttr("value", value); | |
| return None; | |
| } | |
| // __init__ function for alias | |
| Box* aliasInit(BoxedAST* self, Box* name, Box* asname) { | |
| // PyAST_Check(self); | |
| self->giveAttr("name", name); | |
| self->giveAttr("asname", asname); | |
| return None; | |
| } | |
| void setupAST() { | |
| // _ast module | |
| BoxedModule* ast_module = createModule(boxString("_ast"), "__builtin__"); | |
| ast_module->giveAttr("PyCF_ONLY_AST", boxInt(PyCF_ONLY_AST)); | |
| // AST type | |
| AST_cls = BoxedClass::create(type_cls, object_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "AST"); | |
| // ::create takes care of registering the class as a GC root. | |
| AST_cls->giveAttr("__module__", boxString("_ast")); | |
| AST_cls->freeze(); | |
| ast_module->giveAttr("AST", AST_cls); | |
| // mod type | |
| BoxedClass* mod_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "mod"); | |
| ast_module->giveAttr("mod", mod_cls); | |
| mod_cls->giveAttr("__module__", boxString("_ast")); | |
| // mod_cls->freeze(); | |
| // Module type | |
| BoxedClass* Module_cls | |
| = BoxedClass::create(type_cls, mod_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Module"); | |
| ast_module->giveAttr("Module", Module_cls); | |
| Module_cls->giveAttr("__module__", boxString("_ast")); | |
| Module_cls->giveAttr("_fields", BoxedTuple::create({ boxString("body") })); | |
| Module_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ModuleInit, NONE, 2))); | |
| Module_cls->freeze(); | |
| // Interactive type | |
| BoxedClass* Interactive_cls | |
| = BoxedClass::create(type_cls, mod_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Interactive"); | |
| ast_module->giveAttr("Interactive", Interactive_cls); | |
| Interactive_cls->giveAttr("__module__", boxString("_ast")); | |
| Interactive_cls->giveAttr("_fields", BoxedTuple::create({ boxString("body") })); | |
| Interactive_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)InteractiveInit, NONE, 2))); | |
| Interactive_cls->freeze(); | |
| // Expression type | |
| BoxedClass* Expression_cls | |
| = BoxedClass::create(type_cls, mod_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Expression"); | |
| ast_module->giveAttr("Expression", Expression_cls); | |
| Expression_cls->giveAttr("__module__", boxString("_ast")); | |
| Expression_cls->giveAttr("_fields", BoxedTuple::create({ boxString("body") })); | |
| Expression_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ExpressionInit, NONE, 2))); | |
| Expression_cls->freeze(); | |
| // Suite type | |
| BoxedClass* Suite_cls | |
| = BoxedClass::create(type_cls, mod_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Suite"); | |
| ast_module->giveAttr("Suite", Suite_cls); | |
| Suite_cls->giveAttr("__module__", boxString("_ast")); | |
| Suite_cls->giveAttr("_fields", BoxedTuple::create({ boxString("body") })); | |
| Suite_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)SuiteInit, NONE, 2))); | |
| Suite_cls->freeze(); | |
| // stmt type | |
| BoxedClass* stmt_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "stmt"); | |
| ast_module->giveAttr("stmt", stmt_cls); | |
| stmt_cls->giveAttr("__module__", boxString("_ast")); | |
| stmt_cls->giveAttr("_attributes", BoxedTuple::create({ boxString("lineno"), boxString("col_offset") })); | |
| // stmt_cls->freeze(); | |
| // FunctionDef type | |
| BoxedClass* FunctionDef_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "FunctionDef"); | |
| ast_module->giveAttr("FunctionDef", FunctionDef_cls); | |
| FunctionDef_cls->giveAttr("__module__", boxString("_ast")); | |
| FunctionDef_cls->giveAttr("_fields", BoxedTuple::create({ boxString("name"), boxString("args"), boxString("body"), | |
| boxString("decorator_list") })); | |
| FunctionDef_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)FunctionDefInit, NONE, 5))); | |
| FunctionDef_cls->freeze(); | |
| // ClassDef type | |
| BoxedClass* ClassDef_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "ClassDef"); | |
| ast_module->giveAttr("ClassDef", ClassDef_cls); | |
| ClassDef_cls->giveAttr("__module__", boxString("_ast")); | |
| ClassDef_cls->giveAttr("_fields", BoxedTuple::create({ boxString("name"), boxString("bases"), boxString("body"), | |
| boxString("decorator_list") })); | |
| ClassDef_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ClassDefInit, NONE, 5))); | |
| ClassDef_cls->freeze(); | |
| // Return type | |
| BoxedClass* Return_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Return"); | |
| ast_module->giveAttr("Return", Return_cls); | |
| Return_cls->giveAttr("__module__", boxString("_ast")); | |
| Return_cls->giveAttr("_fields", BoxedTuple::create({ boxString("value") })); | |
| Return_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ReturnInit, NONE, 2))); | |
| Return_cls->freeze(); | |
| // Delete type | |
| BoxedClass* Delete_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Delete"); | |
| ast_module->giveAttr("Delete", Delete_cls); | |
| Delete_cls->giveAttr("__module__", boxString("_ast")); | |
| Delete_cls->giveAttr("_fields", BoxedTuple::create({ boxString("targets") })); | |
| Delete_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)DeleteInit, NONE, 2))); | |
| Delete_cls->freeze(); | |
| // Assign type | |
| BoxedClass* Assign_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Assign"); | |
| ast_module->giveAttr("Assign", Assign_cls); | |
| Assign_cls->giveAttr("__module__", boxString("_ast")); | |
| Assign_cls->giveAttr("_fields", BoxedTuple::create({ boxString("targets"), boxString("value") })); | |
| Assign_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)AssignInit, NONE, 3))); | |
| Assign_cls->freeze(); | |
| // AugAssign type | |
| BoxedClass* AugAssign_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "AugAssign"); | |
| ast_module->giveAttr("AugAssign", AugAssign_cls); | |
| AugAssign_cls->giveAttr("__module__", boxString("_ast")); | |
| AugAssign_cls->giveAttr("_fields", | |
| BoxedTuple::create({ boxString("target"), boxString("op"), boxString("value") })); | |
| AugAssign_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)AugAssignInit, NONE, 4))); | |
| AugAssign_cls->freeze(); | |
| // Print type | |
| BoxedClass* Print_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Print"); | |
| ast_module->giveAttr("Print", Print_cls); | |
| Print_cls->giveAttr("__module__", boxString("_ast")); | |
| Print_cls->giveAttr("_fields", BoxedTuple::create({ boxString("dest"), boxString("values"), boxString("nl") })); | |
| Print_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)PrintInit, NONE, 4))); | |
| Print_cls->freeze(); | |
| // For type | |
| BoxedClass* For_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "For"); | |
| ast_module->giveAttr("For", For_cls); | |
| For_cls->giveAttr("__module__", boxString("_ast")); | |
| For_cls->giveAttr("_fields", BoxedTuple::create({ boxString("target"), boxString("iter"), boxString("body"), | |
| boxString("orelse") })); | |
| For_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ForInit, NONE, 5))); | |
| For_cls->freeze(); | |
| // While type | |
| BoxedClass* While_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "While"); | |
| ast_module->giveAttr("While", While_cls); | |
| While_cls->giveAttr("__module__", boxString("_ast")); | |
| While_cls->giveAttr("_fields", BoxedTuple::create({ boxString("test"), boxString("body"), boxString("orelse") })); | |
| While_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)WhileInit, NONE, 4))); | |
| While_cls->freeze(); | |
| // If type | |
| BoxedClass* If_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "If"); | |
| ast_module->giveAttr("If", If_cls); | |
| If_cls->giveAttr("__module__", boxString("_ast")); | |
| If_cls->giveAttr("_fields", BoxedTuple::create({ boxString("test"), boxString("body"), boxString("orelse") })); | |
| If_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)IfInit, NONE, 4))); | |
| If_cls->freeze(); | |
| // With type | |
| BoxedClass* With_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "With"); | |
| ast_module->giveAttr("With", With_cls); | |
| With_cls->giveAttr("__module__", boxString("_ast")); | |
| With_cls->giveAttr( | |
| "_fields", BoxedTuple::create({ boxString("context_expr"), boxString("optional_vars"), boxString("body") })); | |
| With_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)WithInit, NONE, 4))); | |
| With_cls->freeze(); | |
| // Raise type | |
| BoxedClass* Raise_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Raise"); | |
| ast_module->giveAttr("Raise", Raise_cls); | |
| Raise_cls->giveAttr("__module__", boxString("_ast")); | |
| Raise_cls->giveAttr("_fields", BoxedTuple::create({ boxString("type"), boxString("inst"), boxString("tback") })); | |
| Raise_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)RaiseInit, NONE, 4))); | |
| Raise_cls->freeze(); | |
| // TryExcept type | |
| BoxedClass* TryExcept_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "TryExcept"); | |
| ast_module->giveAttr("TryExcept", TryExcept_cls); | |
| TryExcept_cls->giveAttr("__module__", boxString("_ast")); | |
| TryExcept_cls->giveAttr("_fields", | |
| BoxedTuple::create({ boxString("body"), boxString("handlers"), boxString("orelse") })); | |
| TryExcept_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)TryExceptInit, NONE, 4))); | |
| TryExcept_cls->freeze(); | |
| // TryFinally type | |
| BoxedClass* TryFinally_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "TryFinally"); | |
| ast_module->giveAttr("TryFinally", TryFinally_cls); | |
| TryFinally_cls->giveAttr("__module__", boxString("_ast")); | |
| TryFinally_cls->giveAttr("_fields", BoxedTuple::create({ boxString("body"), boxString("finalbody") })); | |
| TryFinally_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)TryFinallyInit, NONE, 3))); | |
| TryFinally_cls->freeze(); | |
| // Assert type | |
| BoxedClass* Assert_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Assert"); | |
| ast_module->giveAttr("Assert", Assert_cls); | |
| Assert_cls->giveAttr("__module__", boxString("_ast")); | |
| Assert_cls->giveAttr("_fields", BoxedTuple::create({ boxString("test"), boxString("msg") })); | |
| Assert_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)AssertInit, NONE, 3))); | |
| Assert_cls->freeze(); | |
| // Import type | |
| BoxedClass* Import_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Import"); | |
| ast_module->giveAttr("Import", Import_cls); | |
| Import_cls->giveAttr("__module__", boxString("_ast")); | |
| Import_cls->giveAttr("_fields", BoxedTuple::create({ boxString("names") })); | |
| Import_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ImportInit, NONE, 2))); | |
| Import_cls->freeze(); | |
| // ImportFrom type | |
| BoxedClass* ImportFrom_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "ImportFrom"); | |
| ast_module->giveAttr("ImportFrom", ImportFrom_cls); | |
| ImportFrom_cls->giveAttr("__module__", boxString("_ast")); | |
| ImportFrom_cls->giveAttr("_fields", | |
| BoxedTuple::create({ boxString("module"), boxString("names"), boxString("level") })); | |
| ImportFrom_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ImportFromInit, NONE, 4))); | |
| ImportFrom_cls->freeze(); | |
| // Exec type | |
| BoxedClass* Exec_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Exec"); | |
| ast_module->giveAttr("Exec", Exec_cls); | |
| Exec_cls->giveAttr("__module__", boxString("_ast")); | |
| Exec_cls->giveAttr("_fields", BoxedTuple::create({ boxString("body"), boxString("globals"), boxString("locals") })); | |
| Exec_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ExecInit, NONE, 4))); | |
| Exec_cls->freeze(); | |
| // Global type | |
| BoxedClass* Global_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Global"); | |
| ast_module->giveAttr("Global", Global_cls); | |
| Global_cls->giveAttr("__module__", boxString("_ast")); | |
| Global_cls->giveAttr("_fields", BoxedTuple::create({ boxString("names") })); | |
| Global_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)GlobalInit, NONE, 2))); | |
| Global_cls->freeze(); | |
| // Expr type | |
| BoxedClass* Expr_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Expr"); | |
| ast_module->giveAttr("Expr", Expr_cls); | |
| Expr_cls->giveAttr("__module__", boxString("_ast")); | |
| Expr_cls->giveAttr("_fields", BoxedTuple::create({ boxString("value") })); | |
| Expr_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ExprInit, NONE, 2))); | |
| Expr_cls->freeze(); | |
| // Pass type | |
| BoxedClass* Pass_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Pass"); | |
| ast_module->giveAttr("Pass", Pass_cls); | |
| Pass_cls->giveAttr("__module__", boxString("_ast")); | |
| Pass_cls->freeze(); | |
| // Break type | |
| BoxedClass* Break_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Break"); | |
| ast_module->giveAttr("Break", Break_cls); | |
| Break_cls->giveAttr("__module__", boxString("_ast")); | |
| Break_cls->freeze(); | |
| // Continue type | |
| BoxedClass* Continue_cls | |
| = BoxedClass::create(type_cls, stmt_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Continue"); | |
| ast_module->giveAttr("Continue", Continue_cls); | |
| Continue_cls->giveAttr("__module__", boxString("_ast")); | |
| Continue_cls->freeze(); | |
| // expr type | |
| BoxedClass* expr_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "expr"); | |
| ast_module->giveAttr("expr", expr_cls); | |
| expr_cls->giveAttr("__module__", boxString("_ast")); | |
| expr_cls->giveAttr("_attributes", BoxedTuple::create({ boxString("lineno"), boxString("col_offset") })); | |
| // expr_cls->freeze(); | |
| // BoolOp type | |
| BoxedClass* BoolOp_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "BoolOp"); | |
| ast_module->giveAttr("BoolOp", BoolOp_cls); | |
| BoolOp_cls->giveAttr("__module__", boxString("_ast")); | |
| BoolOp_cls->giveAttr("_fields", BoxedTuple::create({ boxString("op"), boxString("values") })); | |
| BoolOp_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)BoolOpInit, NONE, 3))); | |
| BoolOp_cls->freeze(); | |
| // BinOp type | |
| BoxedClass* BinOp_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "BinOp"); | |
| ast_module->giveAttr("BinOp", BinOp_cls); | |
| BinOp_cls->giveAttr("__module__", boxString("_ast")); | |
| BinOp_cls->giveAttr("_fields", BoxedTuple::create({ boxString("left"), boxString("op"), boxString("right") })); | |
| BinOp_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)BinOpInit, NONE, 4))); | |
| BinOp_cls->freeze(); | |
| // UnaryOp type | |
| BoxedClass* UnaryOp_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "UnaryOp"); | |
| ast_module->giveAttr("UnaryOp", UnaryOp_cls); | |
| UnaryOp_cls->giveAttr("__module__", boxString("_ast")); | |
| UnaryOp_cls->giveAttr("_fields", BoxedTuple::create({ boxString("op"), boxString("operand") })); | |
| UnaryOp_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)UnaryOpInit, NONE, 3))); | |
| UnaryOp_cls->freeze(); | |
| // Lambda type | |
| BoxedClass* Lambda_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Lambda"); | |
| ast_module->giveAttr("Lambda", Lambda_cls); | |
| Lambda_cls->giveAttr("__module__", boxString("_ast")); | |
| Lambda_cls->giveAttr("_fields", BoxedTuple::create({ boxString("args"), boxString("body") })); | |
| Lambda_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)LambdaInit, NONE, 3))); | |
| Lambda_cls->freeze(); | |
| // IfExp type | |
| BoxedClass* IfExp_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "IfExp"); | |
| ast_module->giveAttr("IfExp", IfExp_cls); | |
| IfExp_cls->giveAttr("__module__", boxString("_ast")); | |
| IfExp_cls->giveAttr("_fields", BoxedTuple::create({ boxString("test"), boxString("body"), boxString("orelse") })); | |
| IfExp_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)IfExpInit, NONE, 4))); | |
| IfExp_cls->freeze(); | |
| // Dict type | |
| BoxedClass* Dict_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Dict"); | |
| ast_module->giveAttr("Dict", Dict_cls); | |
| Dict_cls->giveAttr("__module__", boxString("_ast")); | |
| Dict_cls->giveAttr("_fields", BoxedTuple::create({ boxString("keys"), boxString("values") })); | |
| Dict_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)DictInit, NONE, 3))); | |
| Dict_cls->freeze(); | |
| // Set type | |
| BoxedClass* Set_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Set"); | |
| ast_module->giveAttr("Set", Set_cls); | |
| Set_cls->giveAttr("__module__", boxString("_ast")); | |
| Set_cls->giveAttr("_fields", BoxedTuple::create({ boxString("elts") })); | |
| Set_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)SetInit, NONE, 2))); | |
| Set_cls->freeze(); | |
| // ListComp type | |
| BoxedClass* ListComp_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "ListComp"); | |
| ast_module->giveAttr("ListComp", ListComp_cls); | |
| ListComp_cls->giveAttr("__module__", boxString("_ast")); | |
| ListComp_cls->giveAttr("_fields", BoxedTuple::create({ boxString("elt"), boxString("generators") })); | |
| ListComp_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ListCompInit, NONE, 3))); | |
| ListComp_cls->freeze(); | |
| // SetComp type | |
| BoxedClass* SetComp_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "SetComp"); | |
| ast_module->giveAttr("SetComp", SetComp_cls); | |
| SetComp_cls->giveAttr("__module__", boxString("_ast")); | |
| SetComp_cls->giveAttr("_fields", BoxedTuple::create({ boxString("elt"), boxString("generators") })); | |
| SetComp_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)SetCompInit, NONE, 3))); | |
| SetComp_cls->freeze(); | |
| // DictComp type | |
| BoxedClass* DictComp_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "DictComp"); | |
| ast_module->giveAttr("DictComp", DictComp_cls); | |
| DictComp_cls->giveAttr("__module__", boxString("_ast")); | |
| DictComp_cls->giveAttr("_fields", | |
| BoxedTuple::create({ boxString("key"), boxString("value"), boxString("generators") })); | |
| DictComp_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)DictCompInit, NONE, 4))); | |
| DictComp_cls->freeze(); | |
| // GeneratorExp type | |
| BoxedClass* GeneratorExp_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "GeneratorExp"); | |
| ast_module->giveAttr("GeneratorExp", GeneratorExp_cls); | |
| GeneratorExp_cls->giveAttr("__module__", boxString("_ast")); | |
| GeneratorExp_cls->giveAttr("_fields", BoxedTuple::create({ boxString("elt"), boxString("generators") })); | |
| GeneratorExp_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)GeneratorExpInit, NONE, 3))); | |
| GeneratorExp_cls->freeze(); | |
| // Yield type | |
| BoxedClass* Yield_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Yield"); | |
| ast_module->giveAttr("Yield", Yield_cls); | |
| Yield_cls->giveAttr("__module__", boxString("_ast")); | |
| Yield_cls->giveAttr("_fields", BoxedTuple::create({ boxString("value") })); | |
| Yield_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)YieldInit, NONE, 2))); | |
| Yield_cls->freeze(); | |
| // Compare type | |
| BoxedClass* Compare_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Compare"); | |
| ast_module->giveAttr("Compare", Compare_cls); | |
| Compare_cls->giveAttr("__module__", boxString("_ast")); | |
| Compare_cls->giveAttr("_fields", | |
| BoxedTuple::create({ boxString("left"), boxString("ops"), boxString("comparators") })); | |
| Compare_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)CompareInit, NONE, 4))); | |
| Compare_cls->freeze(); | |
| // Call type | |
| BoxedClass* Call_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Call"); | |
| ast_module->giveAttr("Call", Call_cls); | |
| Call_cls->giveAttr("__module__", boxString("_ast")); | |
| Call_cls->giveAttr("_fields", BoxedTuple::create({ boxString("func"), boxString("args"), boxString("keywords"), | |
| boxString("starargs"), boxString("kwargs") })); | |
| Call_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)CallInit, NONE, 6))); | |
| Call_cls->freeze(); | |
| // Repr type | |
| BoxedClass* Repr_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Repr"); | |
| ast_module->giveAttr("Repr", Repr_cls); | |
| Repr_cls->giveAttr("__module__", boxString("_ast")); | |
| Repr_cls->giveAttr("_fields", BoxedTuple::create({ boxString("value") })); | |
| Repr_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ReprInit, NONE, 2))); | |
| Repr_cls->freeze(); | |
| // Num type | |
| BoxedClass* Num_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Num"); | |
| ast_module->giveAttr("Num", Num_cls); | |
| Num_cls->giveAttr("__module__", boxString("_ast")); | |
| Num_cls->giveAttr("_fields", BoxedTuple::create({ boxString("n") })); | |
| Num_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)NumInit, NONE, 2))); | |
| Num_cls->freeze(); | |
| // Str type | |
| BoxedClass* Str_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Str"); | |
| ast_module->giveAttr("Str", Str_cls); | |
| Str_cls->giveAttr("__module__", boxString("_ast")); | |
| Str_cls->giveAttr("_fields", BoxedTuple::create({ boxString("s") })); | |
| Str_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)StrInit, NONE, 2))); | |
| Str_cls->freeze(); | |
| // Attribute type | |
| BoxedClass* Attribute_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Attribute"); | |
| ast_module->giveAttr("Attribute", Attribute_cls); | |
| Attribute_cls->giveAttr("__module__", boxString("_ast")); | |
| Attribute_cls->giveAttr("_fields", BoxedTuple::create({ boxString("value"), boxString("attr"), boxString("ctx") })); | |
| Attribute_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)AttributeInit, NONE, 4))); | |
| Attribute_cls->freeze(); | |
| // Subscript type | |
| BoxedClass* Subscript_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Subscript"); | |
| ast_module->giveAttr("Subscript", Subscript_cls); | |
| Subscript_cls->giveAttr("__module__", boxString("_ast")); | |
| Subscript_cls->giveAttr("_fields", | |
| BoxedTuple::create({ boxString("value"), boxString("slice"), boxString("ctx") })); | |
| Subscript_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)SubscriptInit, NONE, 4))); | |
| Subscript_cls->freeze(); | |
| // Name type | |
| BoxedClass* Name_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Name"); | |
| ast_module->giveAttr("Name", Name_cls); | |
| Name_cls->giveAttr("__module__", boxString("_ast")); | |
| Name_cls->giveAttr("_fields", BoxedTuple::create({ boxString("id"), boxString("ctx") })); | |
| Name_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)NameInit, NONE, 3))); | |
| Name_cls->freeze(); | |
| // List type | |
| BoxedClass* List_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "List"); | |
| ast_module->giveAttr("List", List_cls); | |
| List_cls->giveAttr("__module__", boxString("_ast")); | |
| List_cls->giveAttr("_fields", BoxedTuple::create({ boxString("elts"), boxString("ctx") })); | |
| List_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ListInit, NONE, 3))); | |
| List_cls->freeze(); | |
| // Tuple type | |
| BoxedClass* Tuple_cls | |
| = BoxedClass::create(type_cls, expr_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Tuple"); | |
| ast_module->giveAttr("Tuple", Tuple_cls); | |
| Tuple_cls->giveAttr("__module__", boxString("_ast")); | |
| Tuple_cls->giveAttr("_fields", BoxedTuple::create({ boxString("elts"), boxString("ctx") })); | |
| Tuple_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)TupleInit, NONE, 3))); | |
| Tuple_cls->freeze(); | |
| // expr_context type | |
| BoxedClass* expr_context_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "expr_context"); | |
| ast_module->giveAttr("expr_context", expr_context_cls); | |
| expr_context_cls->giveAttr("__module__", boxString("_ast")); | |
| // expr_context_cls->freeze(); | |
| // Load type | |
| BoxedClass* Load_cls | |
| = BoxedClass::create(type_cls, expr_context_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Load"); | |
| ast_module->giveAttr("Load", Load_cls); | |
| Load_cls->giveAttr("__module__", boxString("_ast")); | |
| Load_cls->freeze(); | |
| // Store type | |
| BoxedClass* Store_cls = BoxedClass::create(type_cls, expr_context_cls, /* gchandler = */ NULL, 0, 0, | |
| sizeof(BoxedAST), false, "Store"); | |
| ast_module->giveAttr("Store", Store_cls); | |
| Store_cls->giveAttr("__module__", boxString("_ast")); | |
| Store_cls->freeze(); | |
| // Del type | |
| BoxedClass* Del_cls | |
| = BoxedClass::create(type_cls, expr_context_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Del"); | |
| ast_module->giveAttr("Del", Del_cls); | |
| Del_cls->giveAttr("__module__", boxString("_ast")); | |
| Del_cls->freeze(); | |
| // AugLoad type | |
| BoxedClass* AugLoad_cls = BoxedClass::create(type_cls, expr_context_cls, /* gchandler = */ NULL, 0, 0, | |
| sizeof(BoxedAST), false, "AugLoad"); | |
| ast_module->giveAttr("AugLoad", AugLoad_cls); | |
| AugLoad_cls->giveAttr("__module__", boxString("_ast")); | |
| AugLoad_cls->freeze(); | |
| // AugStore type | |
| BoxedClass* AugStore_cls = BoxedClass::create(type_cls, expr_context_cls, /* gchandler = */ NULL, 0, 0, | |
| sizeof(BoxedAST), false, "AugStore"); | |
| ast_module->giveAttr("AugStore", AugStore_cls); | |
| AugStore_cls->giveAttr("__module__", boxString("_ast")); | |
| AugStore_cls->freeze(); | |
| // Param type | |
| BoxedClass* Param_cls = BoxedClass::create(type_cls, expr_context_cls, /* gchandler = */ NULL, 0, 0, | |
| sizeof(BoxedAST), false, "Param"); | |
| ast_module->giveAttr("Param", Param_cls); | |
| Param_cls->giveAttr("__module__", boxString("_ast")); | |
| Param_cls->freeze(); | |
| // slice type | |
| BoxedClass* slice_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "slice"); | |
| ast_module->giveAttr("slice", slice_cls); | |
| slice_cls->giveAttr("__module__", boxString("_ast")); | |
| // slice_cls->freeze(); | |
| // Ellipsis type | |
| BoxedClass* Ellipsis_cls | |
| = BoxedClass::create(type_cls, slice_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Ellipsis"); | |
| ast_module->giveAttr("Ellipsis", Ellipsis_cls); | |
| Ellipsis_cls->giveAttr("__module__", boxString("_ast")); | |
| Ellipsis_cls->freeze(); | |
| // Slice type | |
| BoxedClass* Slice_cls | |
| = BoxedClass::create(type_cls, slice_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Slice"); | |
| ast_module->giveAttr("Slice", Slice_cls); | |
| Slice_cls->giveAttr("__module__", boxString("_ast")); | |
| Slice_cls->giveAttr("_fields", BoxedTuple::create({ boxString("lower"), boxString("upper"), boxString("step") })); | |
| Slice_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)SliceInit, NONE, 4))); | |
| Slice_cls->freeze(); | |
| // ExtSlice type | |
| BoxedClass* ExtSlice_cls | |
| = BoxedClass::create(type_cls, slice_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "ExtSlice"); | |
| ast_module->giveAttr("ExtSlice", ExtSlice_cls); | |
| ExtSlice_cls->giveAttr("__module__", boxString("_ast")); | |
| ExtSlice_cls->giveAttr("_fields", BoxedTuple::create({ boxString("dims") })); | |
| ExtSlice_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ExtSliceInit, NONE, 2))); | |
| ExtSlice_cls->freeze(); | |
| // Index type | |
| BoxedClass* Index_cls | |
| = BoxedClass::create(type_cls, slice_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Index"); | |
| ast_module->giveAttr("Index", Index_cls); | |
| Index_cls->giveAttr("__module__", boxString("_ast")); | |
| Index_cls->giveAttr("_fields", BoxedTuple::create({ boxString("value") })); | |
| Index_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)IndexInit, NONE, 2))); | |
| Index_cls->freeze(); | |
| // boolop type | |
| BoxedClass* boolop_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "boolop"); | |
| ast_module->giveAttr("boolop", boolop_cls); | |
| boolop_cls->giveAttr("__module__", boxString("_ast")); | |
| // boolop_cls->freeze(); | |
| // And type | |
| BoxedClass* And_cls | |
| = BoxedClass::create(type_cls, boolop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "And"); | |
| ast_module->giveAttr("And", And_cls); | |
| And_cls->giveAttr("__module__", boxString("_ast")); | |
| And_cls->freeze(); | |
| // Or type | |
| BoxedClass* Or_cls | |
| = BoxedClass::create(type_cls, boolop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Or"); | |
| ast_module->giveAttr("Or", Or_cls); | |
| Or_cls->giveAttr("__module__", boxString("_ast")); | |
| Or_cls->freeze(); | |
| // operator type | |
| BoxedClass* operator_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "operator"); | |
| ast_module->giveAttr("operator", operator_cls); | |
| operator_cls->giveAttr("__module__", boxString("_ast")); | |
| // operator_cls->freeze(); | |
| // Add type | |
| BoxedClass* Add_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Add"); | |
| ast_module->giveAttr("Add", Add_cls); | |
| Add_cls->giveAttr("__module__", boxString("_ast")); | |
| Add_cls->freeze(); | |
| // Sub type | |
| BoxedClass* Sub_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Sub"); | |
| ast_module->giveAttr("Sub", Sub_cls); | |
| Sub_cls->giveAttr("__module__", boxString("_ast")); | |
| Sub_cls->freeze(); | |
| // Mult type | |
| BoxedClass* Mult_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Mult"); | |
| ast_module->giveAttr("Mult", Mult_cls); | |
| Mult_cls->giveAttr("__module__", boxString("_ast")); | |
| Mult_cls->freeze(); | |
| // Div type | |
| BoxedClass* Div_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Div"); | |
| ast_module->giveAttr("Div", Div_cls); | |
| Div_cls->giveAttr("__module__", boxString("_ast")); | |
| Div_cls->freeze(); | |
| // Mod type | |
| BoxedClass* Mod_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Mod"); | |
| ast_module->giveAttr("Mod", Mod_cls); | |
| Mod_cls->giveAttr("__module__", boxString("_ast")); | |
| Mod_cls->freeze(); | |
| // Pow type | |
| BoxedClass* Pow_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Pow"); | |
| ast_module->giveAttr("Pow", Pow_cls); | |
| Pow_cls->giveAttr("__module__", boxString("_ast")); | |
| Pow_cls->freeze(); | |
| // LShift type | |
| BoxedClass* LShift_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "LShift"); | |
| ast_module->giveAttr("LShift", LShift_cls); | |
| LShift_cls->giveAttr("__module__", boxString("_ast")); | |
| LShift_cls->freeze(); | |
| // RShift type | |
| BoxedClass* RShift_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "RShift"); | |
| ast_module->giveAttr("RShift", RShift_cls); | |
| RShift_cls->giveAttr("__module__", boxString("_ast")); | |
| RShift_cls->freeze(); | |
| // BitOr type | |
| BoxedClass* BitOr_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "BitOr"); | |
| ast_module->giveAttr("BitOr", BitOr_cls); | |
| BitOr_cls->giveAttr("__module__", boxString("_ast")); | |
| BitOr_cls->freeze(); | |
| // BitXor type | |
| BoxedClass* BitXor_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "BitXor"); | |
| ast_module->giveAttr("BitXor", BitXor_cls); | |
| BitXor_cls->giveAttr("__module__", boxString("_ast")); | |
| BitXor_cls->freeze(); | |
| // BitAnd type | |
| BoxedClass* BitAnd_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "BitAnd"); | |
| ast_module->giveAttr("BitAnd", BitAnd_cls); | |
| BitAnd_cls->giveAttr("__module__", boxString("_ast")); | |
| BitAnd_cls->freeze(); | |
| // FloorDiv type | |
| BoxedClass* FloorDiv_cls | |
| = BoxedClass::create(type_cls, operator_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "FloorDiv"); | |
| ast_module->giveAttr("FloorDiv", FloorDiv_cls); | |
| FloorDiv_cls->giveAttr("__module__", boxString("_ast")); | |
| FloorDiv_cls->freeze(); | |
| // unaryop type | |
| BoxedClass* unaryop_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "unaryop"); | |
| ast_module->giveAttr("unaryop", unaryop_cls); | |
| unaryop_cls->giveAttr("__module__", boxString("_ast")); | |
| // unaryop_cls->freeze(); | |
| // Invert type | |
| BoxedClass* Invert_cls | |
| = BoxedClass::create(type_cls, unaryop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Invert"); | |
| ast_module->giveAttr("Invert", Invert_cls); | |
| Invert_cls->giveAttr("__module__", boxString("_ast")); | |
| Invert_cls->freeze(); | |
| // Not type | |
| BoxedClass* Not_cls | |
| = BoxedClass::create(type_cls, unaryop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Not"); | |
| ast_module->giveAttr("Not", Not_cls); | |
| Not_cls->giveAttr("__module__", boxString("_ast")); | |
| Not_cls->freeze(); | |
| // UAdd type | |
| BoxedClass* UAdd_cls | |
| = BoxedClass::create(type_cls, unaryop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "UAdd"); | |
| ast_module->giveAttr("UAdd", UAdd_cls); | |
| UAdd_cls->giveAttr("__module__", boxString("_ast")); | |
| UAdd_cls->freeze(); | |
| // USub type | |
| BoxedClass* USub_cls | |
| = BoxedClass::create(type_cls, unaryop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "USub"); | |
| ast_module->giveAttr("USub", USub_cls); | |
| USub_cls->giveAttr("__module__", boxString("_ast")); | |
| USub_cls->freeze(); | |
| // cmpop type | |
| BoxedClass* cmpop_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "cmpop"); | |
| ast_module->giveAttr("cmpop", cmpop_cls); | |
| cmpop_cls->giveAttr("__module__", boxString("_ast")); | |
| // cmpop_cls->freeze(); | |
| // Eq type | |
| BoxedClass* Eq_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Eq"); | |
| ast_module->giveAttr("Eq", Eq_cls); | |
| Eq_cls->giveAttr("__module__", boxString("_ast")); | |
| Eq_cls->freeze(); | |
| // NotEq type | |
| BoxedClass* NotEq_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "NotEq"); | |
| ast_module->giveAttr("NotEq", NotEq_cls); | |
| NotEq_cls->giveAttr("__module__", boxString("_ast")); | |
| NotEq_cls->freeze(); | |
| // Lt type | |
| BoxedClass* Lt_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Lt"); | |
| ast_module->giveAttr("Lt", Lt_cls); | |
| Lt_cls->giveAttr("__module__", boxString("_ast")); | |
| Lt_cls->freeze(); | |
| // LtE type | |
| BoxedClass* LtE_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "LtE"); | |
| ast_module->giveAttr("LtE", LtE_cls); | |
| LtE_cls->giveAttr("__module__", boxString("_ast")); | |
| LtE_cls->freeze(); | |
| // Gt type | |
| BoxedClass* Gt_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Gt"); | |
| ast_module->giveAttr("Gt", Gt_cls); | |
| Gt_cls->giveAttr("__module__", boxString("_ast")); | |
| Gt_cls->freeze(); | |
| // GtE type | |
| BoxedClass* GtE_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "GtE"); | |
| ast_module->giveAttr("GtE", GtE_cls); | |
| GtE_cls->giveAttr("__module__", boxString("_ast")); | |
| GtE_cls->freeze(); | |
| // Is type | |
| BoxedClass* Is_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "Is"); | |
| ast_module->giveAttr("Is", Is_cls); | |
| Is_cls->giveAttr("__module__", boxString("_ast")); | |
| Is_cls->freeze(); | |
| // IsNot type | |
| BoxedClass* IsNot_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "IsNot"); | |
| ast_module->giveAttr("IsNot", IsNot_cls); | |
| IsNot_cls->giveAttr("__module__", boxString("_ast")); | |
| IsNot_cls->freeze(); | |
| // In type | |
| BoxedClass* In_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "In"); | |
| ast_module->giveAttr("In", In_cls); | |
| In_cls->giveAttr("__module__", boxString("_ast")); | |
| In_cls->freeze(); | |
| // NotIn type | |
| BoxedClass* NotIn_cls | |
| = BoxedClass::create(type_cls, cmpop_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "NotIn"); | |
| ast_module->giveAttr("NotIn", NotIn_cls); | |
| NotIn_cls->giveAttr("__module__", boxString("_ast")); | |
| NotIn_cls->freeze(); | |
| // comprehension type | |
| BoxedClass* comprehension_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "comprehension"); | |
| ast_module->giveAttr("comprehension", comprehension_cls); | |
| comprehension_cls->giveAttr("__module__", boxString("_ast")); | |
| comprehension_cls->giveAttr("_fields", | |
| BoxedTuple::create({ boxString("target"), boxString("iter"), boxString("ifs") })); | |
| comprehension_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)comprehensionInit, NONE, 4))); | |
| comprehension_cls->freeze(); | |
| // excepthandler type | |
| BoxedClass* excepthandler_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "excepthandler"); | |
| ast_module->giveAttr("excepthandler", excepthandler_cls); | |
| excepthandler_cls->giveAttr("__module__", boxString("_ast")); | |
| excepthandler_cls->giveAttr("_attributes", BoxedTuple::create({ boxString("lineno"), boxString("col_offset") })); | |
| // excepthandler_cls->freeze(); | |
| // ExceptHandler type | |
| BoxedClass* ExceptHandler_cls = BoxedClass::create(type_cls, excepthandler_cls, /* gchandler = */ NULL, 0, 0, | |
| sizeof(BoxedAST), false, "ExceptHandler"); | |
| ast_module->giveAttr("ExceptHandler", ExceptHandler_cls); | |
| ExceptHandler_cls->giveAttr("__module__", boxString("_ast")); | |
| ExceptHandler_cls->giveAttr("_fields", | |
| BoxedTuple::create({ boxString("type"), boxString("name"), boxString("body") })); | |
| ExceptHandler_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)ExceptHandlerInit, NONE, 4))); | |
| ExceptHandler_cls->freeze(); | |
| // arguments type | |
| BoxedClass* arguments_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "arguments"); | |
| ast_module->giveAttr("arguments", arguments_cls); | |
| arguments_cls->giveAttr("__module__", boxString("_ast")); | |
| arguments_cls->giveAttr("_fields", BoxedTuple::create({ boxString("args"), boxString("vararg"), boxString("kwarg"), | |
| boxString("defaults") })); | |
| arguments_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)argumentsInit, NONE, 5))); | |
| arguments_cls->freeze(); | |
| // keyword type | |
| BoxedClass* keyword_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "keyword"); | |
| ast_module->giveAttr("keyword", keyword_cls); | |
| keyword_cls->giveAttr("__module__", boxString("_ast")); | |
| keyword_cls->giveAttr("_fields", BoxedTuple::create({ boxString("arg"), boxString("value") })); | |
| keyword_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)keywordInit, NONE, 3))); | |
| keyword_cls->freeze(); | |
| // alias type | |
| BoxedClass* alias_cls | |
| = BoxedClass::create(type_cls, AST_cls, /* gchandler = */ NULL, 0, 0, sizeof(BoxedAST), false, "alias"); | |
| ast_module->giveAttr("alias", alias_cls); | |
| alias_cls->giveAttr("__module__", boxString("_ast")); | |
| alias_cls->giveAttr("_fields", BoxedTuple::create({ boxString("name"), boxString("asname") })); | |
| alias_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)aliasInit, NONE, 3))); | |
| alias_cls->freeze(); | |
| } // end of setupAST | |
| } // end of pyston namespace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment