Mercurial > cpython-lru_cache-weakref
comparison Python/Python-ast.c @ 36669:9504f7ac3669 legacy-trunk
Create _ast module.
Cleanup Python-ast.c generation.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 27 Feb 2006 15:23:19 +0000 |
| parents | 6165927431d6 |
| children | b6d2f6fd3e11 |
comparison
equal
deleted
inserted
replaced
| 36668:8410f06ad36e | 36669:9504f7ac3669 |
|---|---|
| 1 /* File automatically generated by Parser/asdl_c.py */ | 1 /* File automatically generated by Parser/asdl_c.py */ |
| 2 | 2 |
| 3 #include "Python.h" | 3 #include "Python.h" |
| 4 #include "Python-ast.h" | 4 #include "Python-ast.h" |
| 5 | 5 |
| 6 PyTypeObject* AST_type; | |
| 6 PyTypeObject *mod_type; | 7 PyTypeObject *mod_type; |
| 7 static PyObject* ast2obj_mod(void*); | 8 static PyObject* ast2obj_mod(void*); |
| 8 PyTypeObject *Module_type; | 9 PyTypeObject *Module_type; |
| 9 char *Module_fields[]={ | 10 char *Module_fields[]={ |
| 10 "body", | 11 "body", |
| 20 PyTypeObject *Suite_type; | 21 PyTypeObject *Suite_type; |
| 21 char *Suite_fields[]={ | 22 char *Suite_fields[]={ |
| 22 "body", | 23 "body", |
| 23 }; | 24 }; |
| 24 PyTypeObject *stmt_type; | 25 PyTypeObject *stmt_type; |
| 26 char *stmt_attributes[] = { | |
| 27 "lineno", | |
| 28 }; | |
| 25 static PyObject* ast2obj_stmt(void*); | 29 static PyObject* ast2obj_stmt(void*); |
| 26 PyTypeObject *FunctionDef_type; | 30 PyTypeObject *FunctionDef_type; |
| 27 char *FunctionDef_fields[]={ | 31 char *FunctionDef_fields[]={ |
| 28 "name", | 32 "name", |
| 29 "args", | 33 "args", |
| 127 }; | 131 }; |
| 128 PyTypeObject *Pass_type; | 132 PyTypeObject *Pass_type; |
| 129 PyTypeObject *Break_type; | 133 PyTypeObject *Break_type; |
| 130 PyTypeObject *Continue_type; | 134 PyTypeObject *Continue_type; |
| 131 PyTypeObject *expr_type; | 135 PyTypeObject *expr_type; |
| 136 char *expr_attributes[] = { | |
| 137 "lineno", | |
| 138 }; | |
| 132 static PyObject* ast2obj_expr(void*); | 139 static PyObject* ast2obj_expr(void*); |
| 133 PyTypeObject *BoolOp_type; | 140 PyTypeObject *BoolOp_type; |
| 134 char *BoolOp_fields[]={ | 141 char *BoolOp_fields[]={ |
| 135 "op", | 142 "op", |
| 136 "values", | 143 "values", |
| 355 Py_DECREF(fnames); | 362 Py_DECREF(fnames); |
| 356 return NULL; | 363 return NULL; |
| 357 } | 364 } |
| 358 PyTuple_SET_ITEM(fnames, i, field); | 365 PyTuple_SET_ITEM(fnames, i, field); |
| 359 } | 366 } |
| 360 result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sO}", type, base, "_fields", fnames); | 367 result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}", |
| 368 type, base, "_fields", fnames, "__module__", "_ast"); | |
| 361 Py_DECREF(fnames); | 369 Py_DECREF(fnames); |
| 362 return (PyTypeObject*)result; | 370 return (PyTypeObject*)result; |
| 371 } | |
| 372 | |
| 373 static int add_attributes(PyTypeObject* type, char**attrs, int num_fields) | |
| 374 { | |
| 375 int i; | |
| 376 PyObject *s, *l = PyList_New(num_fields); | |
| 377 if (!l) return 0; | |
| 378 for(i=0; i < num_fields; i++) { | |
| 379 s = PyString_FromString(attrs[i]); | |
| 380 if (!s) { | |
| 381 Py_DECREF(l); | |
| 382 return 0; | |
| 383 } | |
| 384 PyList_SET_ITEM(l, i, s); | |
| 385 } | |
| 386 return PyObject_SetAttrString((PyObject*)type, "_attributes", l) >=0; | |
| 363 } | 387 } |
| 364 | 388 |
| 365 static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*)) | 389 static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*)) |
| 366 { | 390 { |
| 367 int i, n = asdl_seq_LEN(seq); | 391 int i, n = asdl_seq_LEN(seq); |
| 392 static PyObject* ast2obj_bool(bool b) | 416 static PyObject* ast2obj_bool(bool b) |
| 393 { | 417 { |
| 394 return PyBool_FromLong(b); | 418 return PyBool_FromLong(b); |
| 395 } | 419 } |
| 396 | 420 |
| 421 static PyObject* ast2obj_int(bool b) | |
| 422 { | |
| 423 return PyInt_FromLong(b); | |
| 424 } | |
| 425 | |
| 397 static int initialized; | 426 static int initialized; |
| 398 static int init_types(void) | 427 static int init_types(void) |
| 399 { | 428 { |
| 400 if (initialized) return 1; | 429 if (initialized) return 1; |
| 401 initialized = 1; | 430 AST_type = make_type("AST", &PyBaseObject_Type, NULL, 0); |
| 402 mod_type = make_type("mod", &PyBaseObject_Type, NULL, 0); | 431 mod_type = make_type("mod", AST_type, NULL, 0); |
| 432 if (!mod_type) return 0; | |
| 433 if (!add_attributes(mod_type, NULL, 0)) return 0; | |
| 403 Module_type = make_type("Module", mod_type, Module_fields, 1); | 434 Module_type = make_type("Module", mod_type, Module_fields, 1); |
| 435 if (!Module_type) return 0; | |
| 404 Interactive_type = make_type("Interactive", mod_type, | 436 Interactive_type = make_type("Interactive", mod_type, |
| 405 Interactive_fields, 1); | 437 Interactive_fields, 1); |
| 438 if (!Interactive_type) return 0; | |
| 406 Expression_type = make_type("Expression", mod_type, Expression_fields, | 439 Expression_type = make_type("Expression", mod_type, Expression_fields, |
| 407 1); | 440 1); |
| 441 if (!Expression_type) return 0; | |
| 408 Suite_type = make_type("Suite", mod_type, Suite_fields, 1); | 442 Suite_type = make_type("Suite", mod_type, Suite_fields, 1); |
| 409 stmt_type = make_type("stmt", &PyBaseObject_Type, NULL, 0); | 443 if (!Suite_type) return 0; |
| 444 stmt_type = make_type("stmt", AST_type, NULL, 0); | |
| 445 if (!stmt_type) return 0; | |
| 446 if (!add_attributes(stmt_type, stmt_attributes, 1)) return 0; | |
| 410 FunctionDef_type = make_type("FunctionDef", stmt_type, | 447 FunctionDef_type = make_type("FunctionDef", stmt_type, |
| 411 FunctionDef_fields, 4); | 448 FunctionDef_fields, 4); |
| 449 if (!FunctionDef_type) return 0; | |
| 412 ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 3); | 450 ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 3); |
| 451 if (!ClassDef_type) return 0; | |
| 413 Return_type = make_type("Return", stmt_type, Return_fields, 1); | 452 Return_type = make_type("Return", stmt_type, Return_fields, 1); |
| 453 if (!Return_type) return 0; | |
| 414 Delete_type = make_type("Delete", stmt_type, Delete_fields, 1); | 454 Delete_type = make_type("Delete", stmt_type, Delete_fields, 1); |
| 455 if (!Delete_type) return 0; | |
| 415 Assign_type = make_type("Assign", stmt_type, Assign_fields, 2); | 456 Assign_type = make_type("Assign", stmt_type, Assign_fields, 2); |
| 457 if (!Assign_type) return 0; | |
| 416 AugAssign_type = make_type("AugAssign", stmt_type, AugAssign_fields, 3); | 458 AugAssign_type = make_type("AugAssign", stmt_type, AugAssign_fields, 3); |
| 459 if (!AugAssign_type) return 0; | |
| 417 Print_type = make_type("Print", stmt_type, Print_fields, 3); | 460 Print_type = make_type("Print", stmt_type, Print_fields, 3); |
| 461 if (!Print_type) return 0; | |
| 418 For_type = make_type("For", stmt_type, For_fields, 4); | 462 For_type = make_type("For", stmt_type, For_fields, 4); |
| 463 if (!For_type) return 0; | |
| 419 While_type = make_type("While", stmt_type, While_fields, 3); | 464 While_type = make_type("While", stmt_type, While_fields, 3); |
| 465 if (!While_type) return 0; | |
| 420 If_type = make_type("If", stmt_type, If_fields, 3); | 466 If_type = make_type("If", stmt_type, If_fields, 3); |
| 467 if (!If_type) return 0; | |
| 421 Raise_type = make_type("Raise", stmt_type, Raise_fields, 3); | 468 Raise_type = make_type("Raise", stmt_type, Raise_fields, 3); |
| 469 if (!Raise_type) return 0; | |
| 422 TryExcept_type = make_type("TryExcept", stmt_type, TryExcept_fields, 3); | 470 TryExcept_type = make_type("TryExcept", stmt_type, TryExcept_fields, 3); |
| 471 if (!TryExcept_type) return 0; | |
| 423 TryFinally_type = make_type("TryFinally", stmt_type, TryFinally_fields, | 472 TryFinally_type = make_type("TryFinally", stmt_type, TryFinally_fields, |
| 424 2); | 473 2); |
| 474 if (!TryFinally_type) return 0; | |
| 425 Assert_type = make_type("Assert", stmt_type, Assert_fields, 2); | 475 Assert_type = make_type("Assert", stmt_type, Assert_fields, 2); |
| 476 if (!Assert_type) return 0; | |
| 426 Import_type = make_type("Import", stmt_type, Import_fields, 1); | 477 Import_type = make_type("Import", stmt_type, Import_fields, 1); |
| 478 if (!Import_type) return 0; | |
| 427 ImportFrom_type = make_type("ImportFrom", stmt_type, ImportFrom_fields, | 479 ImportFrom_type = make_type("ImportFrom", stmt_type, ImportFrom_fields, |
| 428 2); | 480 2); |
| 481 if (!ImportFrom_type) return 0; | |
| 429 Exec_type = make_type("Exec", stmt_type, Exec_fields, 3); | 482 Exec_type = make_type("Exec", stmt_type, Exec_fields, 3); |
| 483 if (!Exec_type) return 0; | |
| 430 Global_type = make_type("Global", stmt_type, Global_fields, 1); | 484 Global_type = make_type("Global", stmt_type, Global_fields, 1); |
| 485 if (!Global_type) return 0; | |
| 431 Expr_type = make_type("Expr", stmt_type, Expr_fields, 1); | 486 Expr_type = make_type("Expr", stmt_type, Expr_fields, 1); |
| 487 if (!Expr_type) return 0; | |
| 432 Pass_type = make_type("Pass", stmt_type, NULL, 0); | 488 Pass_type = make_type("Pass", stmt_type, NULL, 0); |
| 489 if (!Pass_type) return 0; | |
| 433 Break_type = make_type("Break", stmt_type, NULL, 0); | 490 Break_type = make_type("Break", stmt_type, NULL, 0); |
| 491 if (!Break_type) return 0; | |
| 434 Continue_type = make_type("Continue", stmt_type, NULL, 0); | 492 Continue_type = make_type("Continue", stmt_type, NULL, 0); |
| 435 expr_type = make_type("expr", &PyBaseObject_Type, NULL, 0); | 493 if (!Continue_type) return 0; |
| 494 expr_type = make_type("expr", AST_type, NULL, 0); | |
| 495 if (!expr_type) return 0; | |
| 496 if (!add_attributes(expr_type, expr_attributes, 1)) return 0; | |
| 436 BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2); | 497 BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2); |
| 498 if (!BoolOp_type) return 0; | |
| 437 BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3); | 499 BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3); |
| 500 if (!BinOp_type) return 0; | |
| 438 UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2); | 501 UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2); |
| 502 if (!UnaryOp_type) return 0; | |
| 439 Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2); | 503 Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2); |
| 504 if (!Lambda_type) return 0; | |
| 440 IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3); | 505 IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3); |
| 506 if (!IfExp_type) return 0; | |
| 441 Dict_type = make_type("Dict", expr_type, Dict_fields, 2); | 507 Dict_type = make_type("Dict", expr_type, Dict_fields, 2); |
| 508 if (!Dict_type) return 0; | |
| 442 ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2); | 509 ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2); |
| 510 if (!ListComp_type) return 0; | |
| 443 GeneratorExp_type = make_type("GeneratorExp", expr_type, | 511 GeneratorExp_type = make_type("GeneratorExp", expr_type, |
| 444 GeneratorExp_fields, 2); | 512 GeneratorExp_fields, 2); |
| 513 if (!GeneratorExp_type) return 0; | |
| 445 Yield_type = make_type("Yield", expr_type, Yield_fields, 1); | 514 Yield_type = make_type("Yield", expr_type, Yield_fields, 1); |
| 515 if (!Yield_type) return 0; | |
| 446 Compare_type = make_type("Compare", expr_type, Compare_fields, 3); | 516 Compare_type = make_type("Compare", expr_type, Compare_fields, 3); |
| 517 if (!Compare_type) return 0; | |
| 447 Call_type = make_type("Call", expr_type, Call_fields, 5); | 518 Call_type = make_type("Call", expr_type, Call_fields, 5); |
| 519 if (!Call_type) return 0; | |
| 448 Repr_type = make_type("Repr", expr_type, Repr_fields, 1); | 520 Repr_type = make_type("Repr", expr_type, Repr_fields, 1); |
| 521 if (!Repr_type) return 0; | |
| 449 Num_type = make_type("Num", expr_type, Num_fields, 1); | 522 Num_type = make_type("Num", expr_type, Num_fields, 1); |
| 523 if (!Num_type) return 0; | |
| 450 Str_type = make_type("Str", expr_type, Str_fields, 1); | 524 Str_type = make_type("Str", expr_type, Str_fields, 1); |
| 525 if (!Str_type) return 0; | |
| 451 Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3); | 526 Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3); |
| 527 if (!Attribute_type) return 0; | |
| 452 Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3); | 528 Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3); |
| 529 if (!Subscript_type) return 0; | |
| 453 Name_type = make_type("Name", expr_type, Name_fields, 2); | 530 Name_type = make_type("Name", expr_type, Name_fields, 2); |
| 531 if (!Name_type) return 0; | |
| 454 List_type = make_type("List", expr_type, List_fields, 2); | 532 List_type = make_type("List", expr_type, List_fields, 2); |
| 533 if (!List_type) return 0; | |
| 455 Tuple_type = make_type("Tuple", expr_type, Tuple_fields, 2); | 534 Tuple_type = make_type("Tuple", expr_type, Tuple_fields, 2); |
| 456 expr_context_type = make_type("expr_context", &PyBaseObject_Type, NULL, | 535 if (!Tuple_type) return 0; |
| 457 0); | 536 expr_context_type = make_type("expr_context", AST_type, NULL, 0); |
| 537 if (!expr_context_type) return 0; | |
| 538 if (!add_attributes(expr_context_type, NULL, 0)) return 0; | |
| 458 Load_type = make_type("Load", expr_context_type, NULL, 0); | 539 Load_type = make_type("Load", expr_context_type, NULL, 0); |
| 540 if (!Load_type) return 0; | |
| 459 Load_singleton = PyType_GenericNew(Load_type, NULL, NULL); | 541 Load_singleton = PyType_GenericNew(Load_type, NULL, NULL); |
| 542 if (!Load_singleton) return 0; | |
| 460 Store_type = make_type("Store", expr_context_type, NULL, 0); | 543 Store_type = make_type("Store", expr_context_type, NULL, 0); |
| 544 if (!Store_type) return 0; | |
| 461 Store_singleton = PyType_GenericNew(Store_type, NULL, NULL); | 545 Store_singleton = PyType_GenericNew(Store_type, NULL, NULL); |
| 546 if (!Store_singleton) return 0; | |
| 462 Del_type = make_type("Del", expr_context_type, NULL, 0); | 547 Del_type = make_type("Del", expr_context_type, NULL, 0); |
| 548 if (!Del_type) return 0; | |
| 463 Del_singleton = PyType_GenericNew(Del_type, NULL, NULL); | 549 Del_singleton = PyType_GenericNew(Del_type, NULL, NULL); |
| 550 if (!Del_singleton) return 0; | |
| 464 AugLoad_type = make_type("AugLoad", expr_context_type, NULL, 0); | 551 AugLoad_type = make_type("AugLoad", expr_context_type, NULL, 0); |
| 552 if (!AugLoad_type) return 0; | |
| 465 AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL); | 553 AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL); |
| 554 if (!AugLoad_singleton) return 0; | |
| 466 AugStore_type = make_type("AugStore", expr_context_type, NULL, 0); | 555 AugStore_type = make_type("AugStore", expr_context_type, NULL, 0); |
| 556 if (!AugStore_type) return 0; | |
| 467 AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL); | 557 AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL); |
| 558 if (!AugStore_singleton) return 0; | |
| 468 Param_type = make_type("Param", expr_context_type, NULL, 0); | 559 Param_type = make_type("Param", expr_context_type, NULL, 0); |
| 560 if (!Param_type) return 0; | |
| 469 Param_singleton = PyType_GenericNew(Param_type, NULL, NULL); | 561 Param_singleton = PyType_GenericNew(Param_type, NULL, NULL); |
| 470 slice_type = make_type("slice", &PyBaseObject_Type, NULL, 0); | 562 if (!Param_singleton) return 0; |
| 563 slice_type = make_type("slice", AST_type, NULL, 0); | |
| 564 if (!slice_type) return 0; | |
| 565 if (!add_attributes(slice_type, NULL, 0)) return 0; | |
| 471 Ellipsis_type = make_type("Ellipsis", slice_type, NULL, 0); | 566 Ellipsis_type = make_type("Ellipsis", slice_type, NULL, 0); |
| 567 if (!Ellipsis_type) return 0; | |
| 472 Slice_type = make_type("Slice", slice_type, Slice_fields, 3); | 568 Slice_type = make_type("Slice", slice_type, Slice_fields, 3); |
| 569 if (!Slice_type) return 0; | |
| 473 ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1); | 570 ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1); |
| 571 if (!ExtSlice_type) return 0; | |
| 474 Index_type = make_type("Index", slice_type, Index_fields, 1); | 572 Index_type = make_type("Index", slice_type, Index_fields, 1); |
| 475 boolop_type = make_type("boolop", &PyBaseObject_Type, NULL, 0); | 573 if (!Index_type) return 0; |
| 574 boolop_type = make_type("boolop", AST_type, NULL, 0); | |
| 575 if (!boolop_type) return 0; | |
| 576 if (!add_attributes(boolop_type, NULL, 0)) return 0; | |
| 476 And_type = make_type("And", boolop_type, NULL, 0); | 577 And_type = make_type("And", boolop_type, NULL, 0); |
| 578 if (!And_type) return 0; | |
| 477 And_singleton = PyType_GenericNew(And_type, NULL, NULL); | 579 And_singleton = PyType_GenericNew(And_type, NULL, NULL); |
| 580 if (!And_singleton) return 0; | |
| 478 Or_type = make_type("Or", boolop_type, NULL, 0); | 581 Or_type = make_type("Or", boolop_type, NULL, 0); |
| 582 if (!Or_type) return 0; | |
| 479 Or_singleton = PyType_GenericNew(Or_type, NULL, NULL); | 583 Or_singleton = PyType_GenericNew(Or_type, NULL, NULL); |
| 480 operator_type = make_type("operator", &PyBaseObject_Type, NULL, 0); | 584 if (!Or_singleton) return 0; |
| 585 operator_type = make_type("operator", AST_type, NULL, 0); | |
| 586 if (!operator_type) return 0; | |
| 587 if (!add_attributes(operator_type, NULL, 0)) return 0; | |
| 481 Add_type = make_type("Add", operator_type, NULL, 0); | 588 Add_type = make_type("Add", operator_type, NULL, 0); |
| 589 if (!Add_type) return 0; | |
| 482 Add_singleton = PyType_GenericNew(Add_type, NULL, NULL); | 590 Add_singleton = PyType_GenericNew(Add_type, NULL, NULL); |
| 591 if (!Add_singleton) return 0; | |
| 483 Sub_type = make_type("Sub", operator_type, NULL, 0); | 592 Sub_type = make_type("Sub", operator_type, NULL, 0); |
| 593 if (!Sub_type) return 0; | |
| 484 Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL); | 594 Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL); |
| 595 if (!Sub_singleton) return 0; | |
| 485 Mult_type = make_type("Mult", operator_type, NULL, 0); | 596 Mult_type = make_type("Mult", operator_type, NULL, 0); |
| 597 if (!Mult_type) return 0; | |
| 486 Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL); | 598 Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL); |
| 599 if (!Mult_singleton) return 0; | |
| 487 Div_type = make_type("Div", operator_type, NULL, 0); | 600 Div_type = make_type("Div", operator_type, NULL, 0); |
| 601 if (!Div_type) return 0; | |
| 488 Div_singleton = PyType_GenericNew(Div_type, NULL, NULL); | 602 Div_singleton = PyType_GenericNew(Div_type, NULL, NULL); |
| 603 if (!Div_singleton) return 0; | |
| 489 Mod_type = make_type("Mod", operator_type, NULL, 0); | 604 Mod_type = make_type("Mod", operator_type, NULL, 0); |
| 605 if (!Mod_type) return 0; | |
| 490 Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL); | 606 Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL); |
| 607 if (!Mod_singleton) return 0; | |
| 491 Pow_type = make_type("Pow", operator_type, NULL, 0); | 608 Pow_type = make_type("Pow", operator_type, NULL, 0); |
| 609 if (!Pow_type) return 0; | |
| 492 Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL); | 610 Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL); |
| 611 if (!Pow_singleton) return 0; | |
| 493 LShift_type = make_type("LShift", operator_type, NULL, 0); | 612 LShift_type = make_type("LShift", operator_type, NULL, 0); |
| 613 if (!LShift_type) return 0; | |
| 494 LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL); | 614 LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL); |
| 615 if (!LShift_singleton) return 0; | |
| 495 RShift_type = make_type("RShift", operator_type, NULL, 0); | 616 RShift_type = make_type("RShift", operator_type, NULL, 0); |
| 617 if (!RShift_type) return 0; | |
| 496 RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL); | 618 RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL); |
| 619 if (!RShift_singleton) return 0; | |
| 497 BitOr_type = make_type("BitOr", operator_type, NULL, 0); | 620 BitOr_type = make_type("BitOr", operator_type, NULL, 0); |
| 621 if (!BitOr_type) return 0; | |
| 498 BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL); | 622 BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL); |
| 623 if (!BitOr_singleton) return 0; | |
| 499 BitXor_type = make_type("BitXor", operator_type, NULL, 0); | 624 BitXor_type = make_type("BitXor", operator_type, NULL, 0); |
| 625 if (!BitXor_type) return 0; | |
| 500 BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL); | 626 BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL); |
| 627 if (!BitXor_singleton) return 0; | |
| 501 BitAnd_type = make_type("BitAnd", operator_type, NULL, 0); | 628 BitAnd_type = make_type("BitAnd", operator_type, NULL, 0); |
| 629 if (!BitAnd_type) return 0; | |
| 502 BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL); | 630 BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL); |
| 631 if (!BitAnd_singleton) return 0; | |
| 503 FloorDiv_type = make_type("FloorDiv", operator_type, NULL, 0); | 632 FloorDiv_type = make_type("FloorDiv", operator_type, NULL, 0); |
| 633 if (!FloorDiv_type) return 0; | |
| 504 FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL); | 634 FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL); |
| 505 unaryop_type = make_type("unaryop", &PyBaseObject_Type, NULL, 0); | 635 if (!FloorDiv_singleton) return 0; |
| 636 unaryop_type = make_type("unaryop", AST_type, NULL, 0); | |
| 637 if (!unaryop_type) return 0; | |
| 638 if (!add_attributes(unaryop_type, NULL, 0)) return 0; | |
| 506 Invert_type = make_type("Invert", unaryop_type, NULL, 0); | 639 Invert_type = make_type("Invert", unaryop_type, NULL, 0); |
| 640 if (!Invert_type) return 0; | |
| 507 Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL); | 641 Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL); |
| 642 if (!Invert_singleton) return 0; | |
| 508 Not_type = make_type("Not", unaryop_type, NULL, 0); | 643 Not_type = make_type("Not", unaryop_type, NULL, 0); |
| 644 if (!Not_type) return 0; | |
| 509 Not_singleton = PyType_GenericNew(Not_type, NULL, NULL); | 645 Not_singleton = PyType_GenericNew(Not_type, NULL, NULL); |
| 646 if (!Not_singleton) return 0; | |
| 510 UAdd_type = make_type("UAdd", unaryop_type, NULL, 0); | 647 UAdd_type = make_type("UAdd", unaryop_type, NULL, 0); |
| 648 if (!UAdd_type) return 0; | |
| 511 UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL); | 649 UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL); |
| 650 if (!UAdd_singleton) return 0; | |
| 512 USub_type = make_type("USub", unaryop_type, NULL, 0); | 651 USub_type = make_type("USub", unaryop_type, NULL, 0); |
| 652 if (!USub_type) return 0; | |
| 513 USub_singleton = PyType_GenericNew(USub_type, NULL, NULL); | 653 USub_singleton = PyType_GenericNew(USub_type, NULL, NULL); |
| 514 cmpop_type = make_type("cmpop", &PyBaseObject_Type, NULL, 0); | 654 if (!USub_singleton) return 0; |
| 655 cmpop_type = make_type("cmpop", AST_type, NULL, 0); | |
| 656 if (!cmpop_type) return 0; | |
| 657 if (!add_attributes(cmpop_type, NULL, 0)) return 0; | |
| 515 Eq_type = make_type("Eq", cmpop_type, NULL, 0); | 658 Eq_type = make_type("Eq", cmpop_type, NULL, 0); |
| 659 if (!Eq_type) return 0; | |
| 516 Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL); | 660 Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL); |
| 661 if (!Eq_singleton) return 0; | |
| 517 NotEq_type = make_type("NotEq", cmpop_type, NULL, 0); | 662 NotEq_type = make_type("NotEq", cmpop_type, NULL, 0); |
| 663 if (!NotEq_type) return 0; | |
| 518 NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL); | 664 NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL); |
| 665 if (!NotEq_singleton) return 0; | |
| 519 Lt_type = make_type("Lt", cmpop_type, NULL, 0); | 666 Lt_type = make_type("Lt", cmpop_type, NULL, 0); |
| 667 if (!Lt_type) return 0; | |
| 520 Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL); | 668 Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL); |
| 669 if (!Lt_singleton) return 0; | |
| 521 LtE_type = make_type("LtE", cmpop_type, NULL, 0); | 670 LtE_type = make_type("LtE", cmpop_type, NULL, 0); |
| 671 if (!LtE_type) return 0; | |
| 522 LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL); | 672 LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL); |
| 673 if (!LtE_singleton) return 0; | |
| 523 Gt_type = make_type("Gt", cmpop_type, NULL, 0); | 674 Gt_type = make_type("Gt", cmpop_type, NULL, 0); |
| 675 if (!Gt_type) return 0; | |
| 524 Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL); | 676 Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL); |
| 677 if (!Gt_singleton) return 0; | |
| 525 GtE_type = make_type("GtE", cmpop_type, NULL, 0); | 678 GtE_type = make_type("GtE", cmpop_type, NULL, 0); |
| 679 if (!GtE_type) return 0; | |
| 526 GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL); | 680 GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL); |
| 681 if (!GtE_singleton) return 0; | |
| 527 Is_type = make_type("Is", cmpop_type, NULL, 0); | 682 Is_type = make_type("Is", cmpop_type, NULL, 0); |
| 683 if (!Is_type) return 0; | |
| 528 Is_singleton = PyType_GenericNew(Is_type, NULL, NULL); | 684 Is_singleton = PyType_GenericNew(Is_type, NULL, NULL); |
| 685 if (!Is_singleton) return 0; | |
| 529 IsNot_type = make_type("IsNot", cmpop_type, NULL, 0); | 686 IsNot_type = make_type("IsNot", cmpop_type, NULL, 0); |
| 687 if (!IsNot_type) return 0; | |
| 530 IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL); | 688 IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL); |
| 689 if (!IsNot_singleton) return 0; | |
| 531 In_type = make_type("In", cmpop_type, NULL, 0); | 690 In_type = make_type("In", cmpop_type, NULL, 0); |
| 691 if (!In_type) return 0; | |
| 532 In_singleton = PyType_GenericNew(In_type, NULL, NULL); | 692 In_singleton = PyType_GenericNew(In_type, NULL, NULL); |
| 693 if (!In_singleton) return 0; | |
| 533 NotIn_type = make_type("NotIn", cmpop_type, NULL, 0); | 694 NotIn_type = make_type("NotIn", cmpop_type, NULL, 0); |
| 695 if (!NotIn_type) return 0; | |
| 534 NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL); | 696 NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL); |
| 535 comprehension_type = make_type("comprehension", &PyBaseObject_Type, | 697 if (!NotIn_singleton) return 0; |
| 698 comprehension_type = make_type("comprehension", AST_type, | |
| 536 comprehension_fields, 3); | 699 comprehension_fields, 3); |
| 537 excepthandler_type = make_type("excepthandler", &PyBaseObject_Type, | 700 if (!comprehension_type) return 0; |
| 701 excepthandler_type = make_type("excepthandler", AST_type, | |
| 538 excepthandler_fields, 3); | 702 excepthandler_fields, 3); |
| 539 arguments_type = make_type("arguments", &PyBaseObject_Type, | 703 if (!excepthandler_type) return 0; |
| 540 arguments_fields, 4); | 704 arguments_type = make_type("arguments", AST_type, arguments_fields, 4); |
| 541 keyword_type = make_type("keyword", &PyBaseObject_Type, keyword_fields, | 705 if (!arguments_type) return 0; |
| 542 2); | 706 keyword_type = make_type("keyword", AST_type, keyword_fields, 2); |
| 543 alias_type = make_type("alias", &PyBaseObject_Type, alias_fields, 2); | 707 if (!keyword_type) return 0; |
| 544 return 1; | 708 alias_type = make_type("alias", AST_type, alias_fields, 2); |
| 709 if (!alias_type) return 0; | |
| 710 initialized = 1; | |
| 711 return 1; | |
| 545 } | 712 } |
| 546 | 713 |
| 547 mod_ty | 714 mod_ty |
| 548 Module(asdl_seq * body, PyArena *arena) | 715 Module(asdl_seq * body, PyArena *arena) |
| 549 { | 716 { |
| 1700 if (PyObject_SetAttrString(result, "body", value) == -1) | 1867 if (PyObject_SetAttrString(result, "body", value) == -1) |
| 1701 goto failed; | 1868 goto failed; |
| 1702 Py_DECREF(value); | 1869 Py_DECREF(value); |
| 1703 break; | 1870 break; |
| 1704 } | 1871 } |
| 1705 | |
| 1706 return result; | 1872 return result; |
| 1707 failed: | 1873 failed: |
| 1708 Py_XDECREF(value); | 1874 Py_XDECREF(value); |
| 1709 Py_XDECREF(result); | 1875 Py_XDECREF(result); |
| 1710 return NULL; | 1876 return NULL; |
| 2034 case Continue_kind: | 2200 case Continue_kind: |
| 2035 result = PyType_GenericNew(Continue_type, NULL, NULL); | 2201 result = PyType_GenericNew(Continue_type, NULL, NULL); |
| 2036 if (!result) goto failed; | 2202 if (!result) goto failed; |
| 2037 break; | 2203 break; |
| 2038 } | 2204 } |
| 2039 | 2205 value = ast2obj_int(o->lineno); |
| 2206 if (!value) goto failed; | |
| 2207 PyObject_SetAttrString(result, "lineno", value); | |
| 2040 return result; | 2208 return result; |
| 2041 failed: | 2209 failed: |
| 2042 Py_XDECREF(value); | 2210 Py_XDECREF(value); |
| 2043 Py_XDECREF(result); | 2211 Py_XDECREF(result); |
| 2044 return NULL; | 2212 return NULL; |
| 2348 if (PyObject_SetAttrString(result, "ctx", value) == -1) | 2516 if (PyObject_SetAttrString(result, "ctx", value) == -1) |
| 2349 goto failed; | 2517 goto failed; |
| 2350 Py_DECREF(value); | 2518 Py_DECREF(value); |
| 2351 break; | 2519 break; |
| 2352 } | 2520 } |
| 2353 | 2521 value = ast2obj_int(o->lineno); |
| 2522 if (!value) goto failed; | |
| 2523 PyObject_SetAttrString(result, "lineno", value); | |
| 2354 return result; | 2524 return result; |
| 2355 failed: | 2525 failed: |
| 2356 Py_XDECREF(value); | 2526 Py_XDECREF(value); |
| 2357 Py_XDECREF(result); | 2527 Py_XDECREF(result); |
| 2358 return NULL; | 2528 return NULL; |
| 2433 if (PyObject_SetAttrString(result, "value", value) == -1) | 2603 if (PyObject_SetAttrString(result, "value", value) == -1) |
| 2434 goto failed; | 2604 goto failed; |
| 2435 Py_DECREF(value); | 2605 Py_DECREF(value); |
| 2436 break; | 2606 break; |
| 2437 } | 2607 } |
| 2438 | |
| 2439 return result; | 2608 return result; |
| 2440 failed: | 2609 failed: |
| 2441 Py_XDECREF(value); | 2610 Py_XDECREF(value); |
| 2442 Py_XDECREF(result); | 2611 Py_XDECREF(result); |
| 2443 return NULL; | 2612 return NULL; |
| 2576 value = ast2obj_list(o->ifs, ast2obj_expr); | 2745 value = ast2obj_list(o->ifs, ast2obj_expr); |
| 2577 if (!value) goto failed; | 2746 if (!value) goto failed; |
| 2578 if (PyObject_SetAttrString(result, "ifs", value) == -1) | 2747 if (PyObject_SetAttrString(result, "ifs", value) == -1) |
| 2579 goto failed; | 2748 goto failed; |
| 2580 Py_DECREF(value); | 2749 Py_DECREF(value); |
| 2581 | |
| 2582 return result; | 2750 return result; |
| 2583 failed: | 2751 failed: |
| 2584 Py_XDECREF(value); | 2752 Py_XDECREF(value); |
| 2585 Py_XDECREF(result); | 2753 Py_XDECREF(result); |
| 2586 return NULL; | 2754 return NULL; |
| 2611 value = ast2obj_list(o->body, ast2obj_stmt); | 2779 value = ast2obj_list(o->body, ast2obj_stmt); |
| 2612 if (!value) goto failed; | 2780 if (!value) goto failed; |
| 2613 if (PyObject_SetAttrString(result, "body", value) == -1) | 2781 if (PyObject_SetAttrString(result, "body", value) == -1) |
| 2614 goto failed; | 2782 goto failed; |
| 2615 Py_DECREF(value); | 2783 Py_DECREF(value); |
| 2616 | |
| 2617 return result; | 2784 return result; |
| 2618 failed: | 2785 failed: |
| 2619 Py_XDECREF(value); | 2786 Py_XDECREF(value); |
| 2620 Py_XDECREF(result); | 2787 Py_XDECREF(result); |
| 2621 return NULL; | 2788 return NULL; |
| 2651 value = ast2obj_list(o->defaults, ast2obj_expr); | 2818 value = ast2obj_list(o->defaults, ast2obj_expr); |
| 2652 if (!value) goto failed; | 2819 if (!value) goto failed; |
| 2653 if (PyObject_SetAttrString(result, "defaults", value) == -1) | 2820 if (PyObject_SetAttrString(result, "defaults", value) == -1) |
| 2654 goto failed; | 2821 goto failed; |
| 2655 Py_DECREF(value); | 2822 Py_DECREF(value); |
| 2656 | |
| 2657 return result; | 2823 return result; |
| 2658 failed: | 2824 failed: |
| 2659 Py_XDECREF(value); | 2825 Py_XDECREF(value); |
| 2660 Py_XDECREF(result); | 2826 Py_XDECREF(result); |
| 2661 return NULL; | 2827 return NULL; |
| 2681 value = ast2obj_expr(o->value); | 2847 value = ast2obj_expr(o->value); |
| 2682 if (!value) goto failed; | 2848 if (!value) goto failed; |
| 2683 if (PyObject_SetAttrString(result, "value", value) == -1) | 2849 if (PyObject_SetAttrString(result, "value", value) == -1) |
| 2684 goto failed; | 2850 goto failed; |
| 2685 Py_DECREF(value); | 2851 Py_DECREF(value); |
| 2686 | |
| 2687 return result; | 2852 return result; |
| 2688 failed: | 2853 failed: |
| 2689 Py_XDECREF(value); | 2854 Py_XDECREF(value); |
| 2690 Py_XDECREF(result); | 2855 Py_XDECREF(result); |
| 2691 return NULL; | 2856 return NULL; |
| 2711 value = ast2obj_identifier(o->asname); | 2876 value = ast2obj_identifier(o->asname); |
| 2712 if (!value) goto failed; | 2877 if (!value) goto failed; |
| 2713 if (PyObject_SetAttrString(result, "asname", value) == -1) | 2878 if (PyObject_SetAttrString(result, "asname", value) == -1) |
| 2714 goto failed; | 2879 goto failed; |
| 2715 Py_DECREF(value); | 2880 Py_DECREF(value); |
| 2716 | |
| 2717 return result; | 2881 return result; |
| 2718 failed: | 2882 failed: |
| 2719 Py_XDECREF(value); | 2883 Py_XDECREF(value); |
| 2720 Py_XDECREF(result); | 2884 Py_XDECREF(result); |
| 2721 return NULL; | 2885 return NULL; |
| 2722 } | 2886 } |
| 2723 | 2887 |
| 2724 | 2888 |
| 2889 PyMODINIT_FUNC | |
| 2890 init_ast(void) | |
| 2891 { | |
| 2892 PyObject *m, *d; | |
| 2893 if (!init_types()) return; | |
| 2894 m = Py_InitModule3("_ast", NULL, NULL); | |
| 2895 if (!m) return; | |
| 2896 d = PyModule_GetDict(m); | |
| 2897 if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return; | |
| 2898 if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) | |
| 2899 return; | |
| 2900 if(PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; | |
| 2901 if(PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) | |
| 2902 return; | |
| 2903 if(PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type) | |
| 2904 < 0) return; | |
| 2905 if(PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) < | |
| 2906 0) return; | |
| 2907 if(PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return; | |
| 2908 if(PyDict_SetItemString(d, "stmt", (PyObject*)stmt_type) < 0) return; | |
| 2909 if(PyDict_SetItemString(d, "FunctionDef", (PyObject*)FunctionDef_type) | |
| 2910 < 0) return; | |
| 2911 if(PyDict_SetItemString(d, "ClassDef", (PyObject*)ClassDef_type) < 0) | |
| 2912 return; | |
| 2913 if(PyDict_SetItemString(d, "Return", (PyObject*)Return_type) < 0) | |
| 2914 return; | |
| 2915 if(PyDict_SetItemString(d, "Delete", (PyObject*)Delete_type) < 0) | |
| 2916 return; | |
| 2917 if(PyDict_SetItemString(d, "Assign", (PyObject*)Assign_type) < 0) | |
| 2918 return; | |
| 2919 if(PyDict_SetItemString(d, "AugAssign", (PyObject*)AugAssign_type) < 0) | |
| 2920 return; | |
| 2921 if(PyDict_SetItemString(d, "Print", (PyObject*)Print_type) < 0) return; | |
| 2922 if(PyDict_SetItemString(d, "For", (PyObject*)For_type) < 0) return; | |
| 2923 if(PyDict_SetItemString(d, "While", (PyObject*)While_type) < 0) return; | |
| 2924 if(PyDict_SetItemString(d, "If", (PyObject*)If_type) < 0) return; | |
| 2925 if(PyDict_SetItemString(d, "Raise", (PyObject*)Raise_type) < 0) return; | |
| 2926 if(PyDict_SetItemString(d, "TryExcept", (PyObject*)TryExcept_type) < 0) | |
| 2927 return; | |
| 2928 if(PyDict_SetItemString(d, "TryFinally", (PyObject*)TryFinally_type) < | |
| 2929 0) return; | |
| 2930 if(PyDict_SetItemString(d, "Assert", (PyObject*)Assert_type) < 0) | |
| 2931 return; | |
| 2932 if(PyDict_SetItemString(d, "Import", (PyObject*)Import_type) < 0) | |
| 2933 return; | |
| 2934 if(PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) < | |
| 2935 0) return; | |
| 2936 if(PyDict_SetItemString(d, "Exec", (PyObject*)Exec_type) < 0) return; | |
| 2937 if(PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0) | |
| 2938 return; | |
| 2939 if(PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return; | |
| 2940 if(PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return; | |
| 2941 if(PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return; | |
| 2942 if(PyDict_SetItemString(d, "Continue", (PyObject*)Continue_type) < 0) | |
| 2943 return; | |
| 2944 if(PyDict_SetItemString(d, "expr", (PyObject*)expr_type) < 0) return; | |
| 2945 if(PyDict_SetItemString(d, "BoolOp", (PyObject*)BoolOp_type) < 0) | |
| 2946 return; | |
| 2947 if(PyDict_SetItemString(d, "BinOp", (PyObject*)BinOp_type) < 0) return; | |
| 2948 if(PyDict_SetItemString(d, "UnaryOp", (PyObject*)UnaryOp_type) < 0) | |
| 2949 return; | |
| 2950 if(PyDict_SetItemString(d, "Lambda", (PyObject*)Lambda_type) < 0) | |
| 2951 return; | |
| 2952 if(PyDict_SetItemString(d, "IfExp", (PyObject*)IfExp_type) < 0) return; | |
| 2953 if(PyDict_SetItemString(d, "Dict", (PyObject*)Dict_type) < 0) return; | |
| 2954 if(PyDict_SetItemString(d, "ListComp", (PyObject*)ListComp_type) < 0) | |
| 2955 return; | |
| 2956 if(PyDict_SetItemString(d, "GeneratorExp", | |
| 2957 (PyObject*)GeneratorExp_type) < 0) return; | |
| 2958 if(PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return; | |
| 2959 if(PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0) | |
| 2960 return; | |
| 2961 if(PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return; | |
| 2962 if(PyDict_SetItemString(d, "Repr", (PyObject*)Repr_type) < 0) return; | |
| 2963 if(PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return; | |
| 2964 if(PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return; | |
| 2965 if(PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) < 0) | |
| 2966 return; | |
| 2967 if(PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) < 0) | |
| 2968 return; | |
| 2969 if(PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return; | |
| 2970 if(PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return; | |
| 2971 if(PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return; | |
| 2972 if(PyDict_SetItemString(d, "expr_context", | |
| 2973 (PyObject*)expr_context_type) < 0) return; | |
| 2974 if(PyDict_SetItemString(d, "Load", (PyObject*)Load_type) < 0) return; | |
| 2975 if(PyDict_SetItemString(d, "Store", (PyObject*)Store_type) < 0) return; | |
| 2976 if(PyDict_SetItemString(d, "Del", (PyObject*)Del_type) < 0) return; | |
| 2977 if(PyDict_SetItemString(d, "AugLoad", (PyObject*)AugLoad_type) < 0) | |
| 2978 return; | |
| 2979 if(PyDict_SetItemString(d, "AugStore", (PyObject*)AugStore_type) < 0) | |
| 2980 return; | |
| 2981 if(PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return; | |
| 2982 if(PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return; | |
| 2983 if(PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0) | |
| 2984 return; | |
| 2985 if(PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return; | |
| 2986 if(PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0) | |
| 2987 return; | |
| 2988 if(PyDict_SetItemString(d, "Index", (PyObject*)Index_type) < 0) return; | |
| 2989 if(PyDict_SetItemString(d, "boolop", (PyObject*)boolop_type) < 0) | |
| 2990 return; | |
| 2991 if(PyDict_SetItemString(d, "And", (PyObject*)And_type) < 0) return; | |
| 2992 if(PyDict_SetItemString(d, "Or", (PyObject*)Or_type) < 0) return; | |
| 2993 if(PyDict_SetItemString(d, "operator", (PyObject*)operator_type) < 0) | |
| 2994 return; | |
| 2995 if(PyDict_SetItemString(d, "Add", (PyObject*)Add_type) < 0) return; | |
| 2996 if(PyDict_SetItemString(d, "Sub", (PyObject*)Sub_type) < 0) return; | |
| 2997 if(PyDict_SetItemString(d, "Mult", (PyObject*)Mult_type) < 0) return; | |
| 2998 if(PyDict_SetItemString(d, "Div", (PyObject*)Div_type) < 0) return; | |
| 2999 if(PyDict_SetItemString(d, "Mod", (PyObject*)Mod_type) < 0) return; | |
| 3000 if(PyDict_SetItemString(d, "Pow", (PyObject*)Pow_type) < 0) return; | |
| 3001 if(PyDict_SetItemString(d, "LShift", (PyObject*)LShift_type) < 0) | |
| 3002 return; | |
| 3003 if(PyDict_SetItemString(d, "RShift", (PyObject*)RShift_type) < 0) | |
| 3004 return; | |
| 3005 if(PyDict_SetItemString(d, "BitOr", (PyObject*)BitOr_type) < 0) return; | |
| 3006 if(PyDict_SetItemString(d, "BitXor", (PyObject*)BitXor_type) < 0) | |
| 3007 return; | |
| 3008 if(PyDict_SetItemString(d, "BitAnd", (PyObject*)BitAnd_type) < 0) | |
| 3009 return; | |
| 3010 if(PyDict_SetItemString(d, "FloorDiv", (PyObject*)FloorDiv_type) < 0) | |
| 3011 return; | |
| 3012 if(PyDict_SetItemString(d, "unaryop", (PyObject*)unaryop_type) < 0) | |
| 3013 return; | |
| 3014 if(PyDict_SetItemString(d, "Invert", (PyObject*)Invert_type) < 0) | |
| 3015 return; | |
| 3016 if(PyDict_SetItemString(d, "Not", (PyObject*)Not_type) < 0) return; | |
| 3017 if(PyDict_SetItemString(d, "UAdd", (PyObject*)UAdd_type) < 0) return; | |
| 3018 if(PyDict_SetItemString(d, "USub", (PyObject*)USub_type) < 0) return; | |
| 3019 if(PyDict_SetItemString(d, "cmpop", (PyObject*)cmpop_type) < 0) return; | |
| 3020 if(PyDict_SetItemString(d, "Eq", (PyObject*)Eq_type) < 0) return; | |
| 3021 if(PyDict_SetItemString(d, "NotEq", (PyObject*)NotEq_type) < 0) return; | |
| 3022 if(PyDict_SetItemString(d, "Lt", (PyObject*)Lt_type) < 0) return; | |
| 3023 if(PyDict_SetItemString(d, "LtE", (PyObject*)LtE_type) < 0) return; | |
| 3024 if(PyDict_SetItemString(d, "Gt", (PyObject*)Gt_type) < 0) return; | |
| 3025 if(PyDict_SetItemString(d, "GtE", (PyObject*)GtE_type) < 0) return; | |
| 3026 if(PyDict_SetItemString(d, "Is", (PyObject*)Is_type) < 0) return; | |
| 3027 if(PyDict_SetItemString(d, "IsNot", (PyObject*)IsNot_type) < 0) return; | |
| 3028 if(PyDict_SetItemString(d, "In", (PyObject*)In_type) < 0) return; | |
| 3029 if(PyDict_SetItemString(d, "NotIn", (PyObject*)NotIn_type) < 0) return; | |
| 3030 if(PyDict_SetItemString(d, "comprehension", | |
| 3031 (PyObject*)comprehension_type) < 0) return; | |
| 3032 if(PyDict_SetItemString(d, "excepthandler", | |
| 3033 (PyObject*)excepthandler_type) < 0) return; | |
| 3034 if(PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) < 0) | |
| 3035 return; | |
| 3036 if(PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0) | |
| 3037 return; | |
| 3038 if(PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return; | |
| 3039 } | |
| 3040 | |
| 2725 | 3041 |
| 2726 PyObject* PyAST_mod2obj(mod_ty t) | 3042 PyObject* PyAST_mod2obj(mod_ty t) |
| 2727 { | 3043 { |
| 2728 init_types(); | 3044 init_types(); |
| 2729 return ast2obj_mod(t); | 3045 return ast2obj_mod(t); |
