File indexing completed on 2025-01-30 10:18:05
0001
0002
0003 #ifndef Py_INTERNAL_AST_H
0004 #define Py_INTERNAL_AST_H
0005 #ifdef __cplusplus
0006 extern "C" {
0007 #endif
0008
0009 #ifndef Py_BUILD_CORE
0010 # error "this header requires Py_BUILD_CORE define"
0011 #endif
0012
0013 #include "pycore_asdl.h"
0014
0015 typedef struct _mod *mod_ty;
0016
0017 typedef struct _stmt *stmt_ty;
0018
0019 typedef struct _expr *expr_ty;
0020
0021 typedef enum _expr_context { Load=1, Store=2, Del=3 } expr_context_ty;
0022
0023 typedef enum _boolop { And=1, Or=2 } boolop_ty;
0024
0025 typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7,
0026 LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12,
0027 FloorDiv=13 } operator_ty;
0028
0029 typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
0030
0031 typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
0032 In=9, NotIn=10 } cmpop_ty;
0033
0034 typedef struct _comprehension *comprehension_ty;
0035
0036 typedef struct _excepthandler *excepthandler_ty;
0037
0038 typedef struct _arguments *arguments_ty;
0039
0040 typedef struct _arg *arg_ty;
0041
0042 typedef struct _keyword *keyword_ty;
0043
0044 typedef struct _alias *alias_ty;
0045
0046 typedef struct _withitem *withitem_ty;
0047
0048 typedef struct _match_case *match_case_ty;
0049
0050 typedef struct _pattern *pattern_ty;
0051
0052 typedef struct _type_ignore *type_ignore_ty;
0053
0054 typedef struct _type_param *type_param_ty;
0055
0056
0057 typedef struct {
0058 _ASDL_SEQ_HEAD
0059 mod_ty typed_elements[1];
0060 } asdl_mod_seq;
0061
0062 asdl_mod_seq *_Py_asdl_mod_seq_new(Py_ssize_t size, PyArena *arena);
0063
0064 typedef struct {
0065 _ASDL_SEQ_HEAD
0066 stmt_ty typed_elements[1];
0067 } asdl_stmt_seq;
0068
0069 asdl_stmt_seq *_Py_asdl_stmt_seq_new(Py_ssize_t size, PyArena *arena);
0070
0071 typedef struct {
0072 _ASDL_SEQ_HEAD
0073 expr_ty typed_elements[1];
0074 } asdl_expr_seq;
0075
0076 asdl_expr_seq *_Py_asdl_expr_seq_new(Py_ssize_t size, PyArena *arena);
0077
0078 typedef struct {
0079 _ASDL_SEQ_HEAD
0080 comprehension_ty typed_elements[1];
0081 } asdl_comprehension_seq;
0082
0083 asdl_comprehension_seq *_Py_asdl_comprehension_seq_new(Py_ssize_t size, PyArena
0084 *arena);
0085
0086 typedef struct {
0087 _ASDL_SEQ_HEAD
0088 excepthandler_ty typed_elements[1];
0089 } asdl_excepthandler_seq;
0090
0091 asdl_excepthandler_seq *_Py_asdl_excepthandler_seq_new(Py_ssize_t size, PyArena
0092 *arena);
0093
0094 typedef struct {
0095 _ASDL_SEQ_HEAD
0096 arguments_ty typed_elements[1];
0097 } asdl_arguments_seq;
0098
0099 asdl_arguments_seq *_Py_asdl_arguments_seq_new(Py_ssize_t size, PyArena *arena);
0100
0101 typedef struct {
0102 _ASDL_SEQ_HEAD
0103 arg_ty typed_elements[1];
0104 } asdl_arg_seq;
0105
0106 asdl_arg_seq *_Py_asdl_arg_seq_new(Py_ssize_t size, PyArena *arena);
0107
0108 typedef struct {
0109 _ASDL_SEQ_HEAD
0110 keyword_ty typed_elements[1];
0111 } asdl_keyword_seq;
0112
0113 asdl_keyword_seq *_Py_asdl_keyword_seq_new(Py_ssize_t size, PyArena *arena);
0114
0115 typedef struct {
0116 _ASDL_SEQ_HEAD
0117 alias_ty typed_elements[1];
0118 } asdl_alias_seq;
0119
0120 asdl_alias_seq *_Py_asdl_alias_seq_new(Py_ssize_t size, PyArena *arena);
0121
0122 typedef struct {
0123 _ASDL_SEQ_HEAD
0124 withitem_ty typed_elements[1];
0125 } asdl_withitem_seq;
0126
0127 asdl_withitem_seq *_Py_asdl_withitem_seq_new(Py_ssize_t size, PyArena *arena);
0128
0129 typedef struct {
0130 _ASDL_SEQ_HEAD
0131 match_case_ty typed_elements[1];
0132 } asdl_match_case_seq;
0133
0134 asdl_match_case_seq *_Py_asdl_match_case_seq_new(Py_ssize_t size, PyArena
0135 *arena);
0136
0137 typedef struct {
0138 _ASDL_SEQ_HEAD
0139 pattern_ty typed_elements[1];
0140 } asdl_pattern_seq;
0141
0142 asdl_pattern_seq *_Py_asdl_pattern_seq_new(Py_ssize_t size, PyArena *arena);
0143
0144 typedef struct {
0145 _ASDL_SEQ_HEAD
0146 type_ignore_ty typed_elements[1];
0147 } asdl_type_ignore_seq;
0148
0149 asdl_type_ignore_seq *_Py_asdl_type_ignore_seq_new(Py_ssize_t size, PyArena
0150 *arena);
0151
0152 typedef struct {
0153 _ASDL_SEQ_HEAD
0154 type_param_ty typed_elements[1];
0155 } asdl_type_param_seq;
0156
0157 asdl_type_param_seq *_Py_asdl_type_param_seq_new(Py_ssize_t size, PyArena
0158 *arena);
0159
0160
0161 enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
0162 FunctionType_kind=4};
0163 struct _mod {
0164 enum _mod_kind kind;
0165 union {
0166 struct {
0167 asdl_stmt_seq *body;
0168 asdl_type_ignore_seq *type_ignores;
0169 } Module;
0170
0171 struct {
0172 asdl_stmt_seq *body;
0173 } Interactive;
0174
0175 struct {
0176 expr_ty body;
0177 } Expression;
0178
0179 struct {
0180 asdl_expr_seq *argtypes;
0181 expr_ty returns;
0182 } FunctionType;
0183
0184 } v;
0185 };
0186
0187 enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3,
0188 Return_kind=4, Delete_kind=5, Assign_kind=6,
0189 TypeAlias_kind=7, AugAssign_kind=8, AnnAssign_kind=9,
0190 For_kind=10, AsyncFor_kind=11, While_kind=12, If_kind=13,
0191 With_kind=14, AsyncWith_kind=15, Match_kind=16,
0192 Raise_kind=17, Try_kind=18, TryStar_kind=19, Assert_kind=20,
0193 Import_kind=21, ImportFrom_kind=22, Global_kind=23,
0194 Nonlocal_kind=24, Expr_kind=25, Pass_kind=26, Break_kind=27,
0195 Continue_kind=28};
0196 struct _stmt {
0197 enum _stmt_kind kind;
0198 union {
0199 struct {
0200 identifier name;
0201 arguments_ty args;
0202 asdl_stmt_seq *body;
0203 asdl_expr_seq *decorator_list;
0204 expr_ty returns;
0205 string type_comment;
0206 asdl_type_param_seq *type_params;
0207 } FunctionDef;
0208
0209 struct {
0210 identifier name;
0211 arguments_ty args;
0212 asdl_stmt_seq *body;
0213 asdl_expr_seq *decorator_list;
0214 expr_ty returns;
0215 string type_comment;
0216 asdl_type_param_seq *type_params;
0217 } AsyncFunctionDef;
0218
0219 struct {
0220 identifier name;
0221 asdl_expr_seq *bases;
0222 asdl_keyword_seq *keywords;
0223 asdl_stmt_seq *body;
0224 asdl_expr_seq *decorator_list;
0225 asdl_type_param_seq *type_params;
0226 } ClassDef;
0227
0228 struct {
0229 expr_ty value;
0230 } Return;
0231
0232 struct {
0233 asdl_expr_seq *targets;
0234 } Delete;
0235
0236 struct {
0237 asdl_expr_seq *targets;
0238 expr_ty value;
0239 string type_comment;
0240 } Assign;
0241
0242 struct {
0243 expr_ty name;
0244 asdl_type_param_seq *type_params;
0245 expr_ty value;
0246 } TypeAlias;
0247
0248 struct {
0249 expr_ty target;
0250 operator_ty op;
0251 expr_ty value;
0252 } AugAssign;
0253
0254 struct {
0255 expr_ty target;
0256 expr_ty annotation;
0257 expr_ty value;
0258 int simple;
0259 } AnnAssign;
0260
0261 struct {
0262 expr_ty target;
0263 expr_ty iter;
0264 asdl_stmt_seq *body;
0265 asdl_stmt_seq *orelse;
0266 string type_comment;
0267 } For;
0268
0269 struct {
0270 expr_ty target;
0271 expr_ty iter;
0272 asdl_stmt_seq *body;
0273 asdl_stmt_seq *orelse;
0274 string type_comment;
0275 } AsyncFor;
0276
0277 struct {
0278 expr_ty test;
0279 asdl_stmt_seq *body;
0280 asdl_stmt_seq *orelse;
0281 } While;
0282
0283 struct {
0284 expr_ty test;
0285 asdl_stmt_seq *body;
0286 asdl_stmt_seq *orelse;
0287 } If;
0288
0289 struct {
0290 asdl_withitem_seq *items;
0291 asdl_stmt_seq *body;
0292 string type_comment;
0293 } With;
0294
0295 struct {
0296 asdl_withitem_seq *items;
0297 asdl_stmt_seq *body;
0298 string type_comment;
0299 } AsyncWith;
0300
0301 struct {
0302 expr_ty subject;
0303 asdl_match_case_seq *cases;
0304 } Match;
0305
0306 struct {
0307 expr_ty exc;
0308 expr_ty cause;
0309 } Raise;
0310
0311 struct {
0312 asdl_stmt_seq *body;
0313 asdl_excepthandler_seq *handlers;
0314 asdl_stmt_seq *orelse;
0315 asdl_stmt_seq *finalbody;
0316 } Try;
0317
0318 struct {
0319 asdl_stmt_seq *body;
0320 asdl_excepthandler_seq *handlers;
0321 asdl_stmt_seq *orelse;
0322 asdl_stmt_seq *finalbody;
0323 } TryStar;
0324
0325 struct {
0326 expr_ty test;
0327 expr_ty msg;
0328 } Assert;
0329
0330 struct {
0331 asdl_alias_seq *names;
0332 } Import;
0333
0334 struct {
0335 identifier module;
0336 asdl_alias_seq *names;
0337 int level;
0338 } ImportFrom;
0339
0340 struct {
0341 asdl_identifier_seq *names;
0342 } Global;
0343
0344 struct {
0345 asdl_identifier_seq *names;
0346 } Nonlocal;
0347
0348 struct {
0349 expr_ty value;
0350 } Expr;
0351
0352 } v;
0353 int lineno;
0354 int col_offset;
0355 int end_lineno;
0356 int end_col_offset;
0357 };
0358
0359 enum _expr_kind {BoolOp_kind=1, NamedExpr_kind=2, BinOp_kind=3, UnaryOp_kind=4,
0360 Lambda_kind=5, IfExp_kind=6, Dict_kind=7, Set_kind=8,
0361 ListComp_kind=9, SetComp_kind=10, DictComp_kind=11,
0362 GeneratorExp_kind=12, Await_kind=13, Yield_kind=14,
0363 YieldFrom_kind=15, Compare_kind=16, Call_kind=17,
0364 FormattedValue_kind=18, JoinedStr_kind=19, Constant_kind=20,
0365 Attribute_kind=21, Subscript_kind=22, Starred_kind=23,
0366 Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27};
0367 struct _expr {
0368 enum _expr_kind kind;
0369 union {
0370 struct {
0371 boolop_ty op;
0372 asdl_expr_seq *values;
0373 } BoolOp;
0374
0375 struct {
0376 expr_ty target;
0377 expr_ty value;
0378 } NamedExpr;
0379
0380 struct {
0381 expr_ty left;
0382 operator_ty op;
0383 expr_ty right;
0384 } BinOp;
0385
0386 struct {
0387 unaryop_ty op;
0388 expr_ty operand;
0389 } UnaryOp;
0390
0391 struct {
0392 arguments_ty args;
0393 expr_ty body;
0394 } Lambda;
0395
0396 struct {
0397 expr_ty test;
0398 expr_ty body;
0399 expr_ty orelse;
0400 } IfExp;
0401
0402 struct {
0403 asdl_expr_seq *keys;
0404 asdl_expr_seq *values;
0405 } Dict;
0406
0407 struct {
0408 asdl_expr_seq *elts;
0409 } Set;
0410
0411 struct {
0412 expr_ty elt;
0413 asdl_comprehension_seq *generators;
0414 } ListComp;
0415
0416 struct {
0417 expr_ty elt;
0418 asdl_comprehension_seq *generators;
0419 } SetComp;
0420
0421 struct {
0422 expr_ty key;
0423 expr_ty value;
0424 asdl_comprehension_seq *generators;
0425 } DictComp;
0426
0427 struct {
0428 expr_ty elt;
0429 asdl_comprehension_seq *generators;
0430 } GeneratorExp;
0431
0432 struct {
0433 expr_ty value;
0434 } Await;
0435
0436 struct {
0437 expr_ty value;
0438 } Yield;
0439
0440 struct {
0441 expr_ty value;
0442 } YieldFrom;
0443
0444 struct {
0445 expr_ty left;
0446 asdl_int_seq *ops;
0447 asdl_expr_seq *comparators;
0448 } Compare;
0449
0450 struct {
0451 expr_ty func;
0452 asdl_expr_seq *args;
0453 asdl_keyword_seq *keywords;
0454 } Call;
0455
0456 struct {
0457 expr_ty value;
0458 int conversion;
0459 expr_ty format_spec;
0460 } FormattedValue;
0461
0462 struct {
0463 asdl_expr_seq *values;
0464 } JoinedStr;
0465
0466 struct {
0467 constant value;
0468 string kind;
0469 } Constant;
0470
0471 struct {
0472 expr_ty value;
0473 identifier attr;
0474 expr_context_ty ctx;
0475 } Attribute;
0476
0477 struct {
0478 expr_ty value;
0479 expr_ty slice;
0480 expr_context_ty ctx;
0481 } Subscript;
0482
0483 struct {
0484 expr_ty value;
0485 expr_context_ty ctx;
0486 } Starred;
0487
0488 struct {
0489 identifier id;
0490 expr_context_ty ctx;
0491 } Name;
0492
0493 struct {
0494 asdl_expr_seq *elts;
0495 expr_context_ty ctx;
0496 } List;
0497
0498 struct {
0499 asdl_expr_seq *elts;
0500 expr_context_ty ctx;
0501 } Tuple;
0502
0503 struct {
0504 expr_ty lower;
0505 expr_ty upper;
0506 expr_ty step;
0507 } Slice;
0508
0509 } v;
0510 int lineno;
0511 int col_offset;
0512 int end_lineno;
0513 int end_col_offset;
0514 };
0515
0516 struct _comprehension {
0517 expr_ty target;
0518 expr_ty iter;
0519 asdl_expr_seq *ifs;
0520 int is_async;
0521 };
0522
0523 enum _excepthandler_kind {ExceptHandler_kind=1};
0524 struct _excepthandler {
0525 enum _excepthandler_kind kind;
0526 union {
0527 struct {
0528 expr_ty type;
0529 identifier name;
0530 asdl_stmt_seq *body;
0531 } ExceptHandler;
0532
0533 } v;
0534 int lineno;
0535 int col_offset;
0536 int end_lineno;
0537 int end_col_offset;
0538 };
0539
0540 struct _arguments {
0541 asdl_arg_seq *posonlyargs;
0542 asdl_arg_seq *args;
0543 arg_ty vararg;
0544 asdl_arg_seq *kwonlyargs;
0545 asdl_expr_seq *kw_defaults;
0546 arg_ty kwarg;
0547 asdl_expr_seq *defaults;
0548 };
0549
0550 struct _arg {
0551 identifier arg;
0552 expr_ty annotation;
0553 string type_comment;
0554 int lineno;
0555 int col_offset;
0556 int end_lineno;
0557 int end_col_offset;
0558 };
0559
0560 struct _keyword {
0561 identifier arg;
0562 expr_ty value;
0563 int lineno;
0564 int col_offset;
0565 int end_lineno;
0566 int end_col_offset;
0567 };
0568
0569 struct _alias {
0570 identifier name;
0571 identifier asname;
0572 int lineno;
0573 int col_offset;
0574 int end_lineno;
0575 int end_col_offset;
0576 };
0577
0578 struct _withitem {
0579 expr_ty context_expr;
0580 expr_ty optional_vars;
0581 };
0582
0583 struct _match_case {
0584 pattern_ty pattern;
0585 expr_ty guard;
0586 asdl_stmt_seq *body;
0587 };
0588
0589 enum _pattern_kind {MatchValue_kind=1, MatchSingleton_kind=2,
0590 MatchSequence_kind=3, MatchMapping_kind=4,
0591 MatchClass_kind=5, MatchStar_kind=6, MatchAs_kind=7,
0592 MatchOr_kind=8};
0593 struct _pattern {
0594 enum _pattern_kind kind;
0595 union {
0596 struct {
0597 expr_ty value;
0598 } MatchValue;
0599
0600 struct {
0601 constant value;
0602 } MatchSingleton;
0603
0604 struct {
0605 asdl_pattern_seq *patterns;
0606 } MatchSequence;
0607
0608 struct {
0609 asdl_expr_seq *keys;
0610 asdl_pattern_seq *patterns;
0611 identifier rest;
0612 } MatchMapping;
0613
0614 struct {
0615 expr_ty cls;
0616 asdl_pattern_seq *patterns;
0617 asdl_identifier_seq *kwd_attrs;
0618 asdl_pattern_seq *kwd_patterns;
0619 } MatchClass;
0620
0621 struct {
0622 identifier name;
0623 } MatchStar;
0624
0625 struct {
0626 pattern_ty pattern;
0627 identifier name;
0628 } MatchAs;
0629
0630 struct {
0631 asdl_pattern_seq *patterns;
0632 } MatchOr;
0633
0634 } v;
0635 int lineno;
0636 int col_offset;
0637 int end_lineno;
0638 int end_col_offset;
0639 };
0640
0641 enum _type_ignore_kind {TypeIgnore_kind=1};
0642 struct _type_ignore {
0643 enum _type_ignore_kind kind;
0644 union {
0645 struct {
0646 int lineno;
0647 string tag;
0648 } TypeIgnore;
0649
0650 } v;
0651 };
0652
0653 enum _type_param_kind {TypeVar_kind=1, ParamSpec_kind=2, TypeVarTuple_kind=3};
0654 struct _type_param {
0655 enum _type_param_kind kind;
0656 union {
0657 struct {
0658 identifier name;
0659 expr_ty bound;
0660 } TypeVar;
0661
0662 struct {
0663 identifier name;
0664 } ParamSpec;
0665
0666 struct {
0667 identifier name;
0668 } TypeVarTuple;
0669
0670 } v;
0671 int lineno;
0672 int col_offset;
0673 int end_lineno;
0674 int end_col_offset;
0675 };
0676
0677
0678
0679 mod_ty _PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores,
0680 PyArena *arena);
0681 mod_ty _PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena);
0682 mod_ty _PyAST_Expression(expr_ty body, PyArena *arena);
0683 mod_ty _PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena
0684 *arena);
0685 stmt_ty _PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq *
0686 body, asdl_expr_seq * decorator_list, expr_ty
0687 returns, string type_comment, asdl_type_param_seq *
0688 type_params, int lineno, int col_offset, int
0689 end_lineno, int end_col_offset, PyArena *arena);
0690 stmt_ty _PyAST_AsyncFunctionDef(identifier name, arguments_ty args,
0691 asdl_stmt_seq * body, asdl_expr_seq *
0692 decorator_list, expr_ty returns, string
0693 type_comment, asdl_type_param_seq *
0694 type_params, int lineno, int col_offset, int
0695 end_lineno, int end_col_offset, PyArena *arena);
0696 stmt_ty _PyAST_ClassDef(identifier name, asdl_expr_seq * bases,
0697 asdl_keyword_seq * keywords, asdl_stmt_seq * body,
0698 asdl_expr_seq * decorator_list, asdl_type_param_seq *
0699 type_params, int lineno, int col_offset, int
0700 end_lineno, int end_col_offset, PyArena *arena);
0701 stmt_ty _PyAST_Return(expr_ty value, int lineno, int col_offset, int
0702 end_lineno, int end_col_offset, PyArena *arena);
0703 stmt_ty _PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int
0704 end_lineno, int end_col_offset, PyArena *arena);
0705 stmt_ty _PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string
0706 type_comment, int lineno, int col_offset, int end_lineno,
0707 int end_col_offset, PyArena *arena);
0708 stmt_ty _PyAST_TypeAlias(expr_ty name, asdl_type_param_seq * type_params,
0709 expr_ty value, int lineno, int col_offset, int
0710 end_lineno, int end_col_offset, PyArena *arena);
0711 stmt_ty _PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
0712 lineno, int col_offset, int end_lineno, int
0713 end_col_offset, PyArena *arena);
0714 stmt_ty _PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int
0715 simple, int lineno, int col_offset, int end_lineno,
0716 int end_col_offset, PyArena *arena);
0717 stmt_ty _PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
0718 asdl_stmt_seq * orelse, string type_comment, int lineno, int
0719 col_offset, int end_lineno, int end_col_offset, PyArena
0720 *arena);
0721 stmt_ty _PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
0722 asdl_stmt_seq * orelse, string type_comment, int
0723 lineno, int col_offset, int end_lineno, int
0724 end_col_offset, PyArena *arena);
0725 stmt_ty _PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq *
0726 orelse, int lineno, int col_offset, int end_lineno, int
0727 end_col_offset, PyArena *arena);
0728 stmt_ty _PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse,
0729 int lineno, int col_offset, int end_lineno, int
0730 end_col_offset, PyArena *arena);
0731 stmt_ty _PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string
0732 type_comment, int lineno, int col_offset, int end_lineno,
0733 int end_col_offset, PyArena *arena);
0734 stmt_ty _PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body,
0735 string type_comment, int lineno, int col_offset, int
0736 end_lineno, int end_col_offset, PyArena *arena);
0737 stmt_ty _PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno,
0738 int col_offset, int end_lineno, int end_col_offset,
0739 PyArena *arena);
0740 stmt_ty _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,
0741 int end_lineno, int end_col_offset, PyArena *arena);
0742 stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
0743 asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int
0744 lineno, int col_offset, int end_lineno, int end_col_offset,
0745 PyArena *arena);
0746 stmt_ty _PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
0747 asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int
0748 lineno, int col_offset, int end_lineno, int
0749 end_col_offset, PyArena *arena);
0750 stmt_ty _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
0751 int end_lineno, int end_col_offset, PyArena *arena);
0752 stmt_ty _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int
0753 end_lineno, int end_col_offset, PyArena *arena);
0754 stmt_ty _PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level,
0755 int lineno, int col_offset, int end_lineno, int
0756 end_col_offset, PyArena *arena);
0757 stmt_ty _PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset,
0758 int end_lineno, int end_col_offset, PyArena *arena);
0759 stmt_ty _PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int
0760 col_offset, int end_lineno, int end_col_offset, PyArena
0761 *arena);
0762 stmt_ty _PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno,
0763 int end_col_offset, PyArena *arena);
0764 stmt_ty _PyAST_Pass(int lineno, int col_offset, int end_lineno, int
0765 end_col_offset, PyArena *arena);
0766 stmt_ty _PyAST_Break(int lineno, int col_offset, int end_lineno, int
0767 end_col_offset, PyArena *arena);
0768 stmt_ty _PyAST_Continue(int lineno, int col_offset, int end_lineno, int
0769 end_col_offset, PyArena *arena);
0770 expr_ty _PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int
0771 col_offset, int end_lineno, int end_col_offset, PyArena
0772 *arena);
0773 expr_ty _PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int
0774 col_offset, int end_lineno, int end_col_offset,
0775 PyArena *arena);
0776 expr_ty _PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno,
0777 int col_offset, int end_lineno, int end_col_offset,
0778 PyArena *arena);
0779 expr_ty _PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int
0780 col_offset, int end_lineno, int end_col_offset, PyArena
0781 *arena);
0782 expr_ty _PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int
0783 col_offset, int end_lineno, int end_col_offset, PyArena
0784 *arena);
0785 expr_ty _PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno,
0786 int col_offset, int end_lineno, int end_col_offset,
0787 PyArena *arena);
0788 expr_ty _PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno,
0789 int col_offset, int end_lineno, int end_col_offset, PyArena
0790 *arena);
0791 expr_ty _PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int
0792 end_lineno, int end_col_offset, PyArena *arena);
0793 expr_ty _PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int
0794 lineno, int col_offset, int end_lineno, int
0795 end_col_offset, PyArena *arena);
0796 expr_ty _PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int
0797 lineno, int col_offset, int end_lineno, int
0798 end_col_offset, PyArena *arena);
0799 expr_ty _PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq *
0800 generators, int lineno, int col_offset, int end_lineno,
0801 int end_col_offset, PyArena *arena);
0802 expr_ty _PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators,
0803 int lineno, int col_offset, int end_lineno, int
0804 end_col_offset, PyArena *arena);
0805 expr_ty _PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno,
0806 int end_col_offset, PyArena *arena);
0807 expr_ty _PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno,
0808 int end_col_offset, PyArena *arena);
0809 expr_ty _PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int
0810 end_lineno, int end_col_offset, PyArena *arena);
0811 expr_ty _PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq *
0812 comparators, int lineno, int col_offset, int end_lineno,
0813 int end_col_offset, PyArena *arena);
0814 expr_ty _PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq *
0815 keywords, int lineno, int col_offset, int end_lineno, int
0816 end_col_offset, PyArena *arena);
0817 expr_ty _PyAST_FormattedValue(expr_ty value, int conversion, expr_ty
0818 format_spec, int lineno, int col_offset, int
0819 end_lineno, int end_col_offset, PyArena *arena);
0820 expr_ty _PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset,
0821 int end_lineno, int end_col_offset, PyArena *arena);
0822 expr_ty _PyAST_Constant(constant value, string kind, int lineno, int
0823 col_offset, int end_lineno, int end_col_offset, PyArena
0824 *arena);
0825 expr_ty _PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx,
0826 int lineno, int col_offset, int end_lineno, int
0827 end_col_offset, PyArena *arena);
0828 expr_ty _PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int
0829 lineno, int col_offset, int end_lineno, int
0830 end_col_offset, PyArena *arena);
0831 expr_ty _PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int
0832 col_offset, int end_lineno, int end_col_offset, PyArena
0833 *arena);
0834 expr_ty _PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int
0835 col_offset, int end_lineno, int end_col_offset, PyArena
0836 *arena);
0837 expr_ty _PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
0838 col_offset, int end_lineno, int end_col_offset, PyArena
0839 *arena);
0840 expr_ty _PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
0841 col_offset, int end_lineno, int end_col_offset, PyArena
0842 *arena);
0843 expr_ty _PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno,
0844 int col_offset, int end_lineno, int end_col_offset,
0845 PyArena *arena);
0846 comprehension_ty _PyAST_comprehension(expr_ty target, expr_ty iter,
0847 asdl_expr_seq * ifs, int is_async,
0848 PyArena *arena);
0849 excepthandler_ty _PyAST_ExceptHandler(expr_ty type, identifier name,
0850 asdl_stmt_seq * body, int lineno, int
0851 col_offset, int end_lineno, int
0852 end_col_offset, PyArena *arena);
0853 arguments_ty _PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args,
0854 arg_ty vararg, asdl_arg_seq * kwonlyargs,
0855 asdl_expr_seq * kw_defaults, arg_ty kwarg,
0856 asdl_expr_seq * defaults, PyArena *arena);
0857 arg_ty _PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int
0858 lineno, int col_offset, int end_lineno, int end_col_offset,
0859 PyArena *arena);
0860 keyword_ty _PyAST_keyword(identifier arg, expr_ty value, int lineno, int
0861 col_offset, int end_lineno, int end_col_offset,
0862 PyArena *arena);
0863 alias_ty _PyAST_alias(identifier name, identifier asname, int lineno, int
0864 col_offset, int end_lineno, int end_col_offset, PyArena
0865 *arena);
0866 withitem_ty _PyAST_withitem(expr_ty context_expr, expr_ty optional_vars,
0867 PyArena *arena);
0868 match_case_ty _PyAST_match_case(pattern_ty pattern, expr_ty guard,
0869 asdl_stmt_seq * body, PyArena *arena);
0870 pattern_ty _PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int
0871 end_lineno, int end_col_offset, PyArena *arena);
0872 pattern_ty _PyAST_MatchSingleton(constant value, int lineno, int col_offset,
0873 int end_lineno, int end_col_offset, PyArena
0874 *arena);
0875 pattern_ty _PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int
0876 col_offset, int end_lineno, int end_col_offset,
0877 PyArena *arena);
0878 pattern_ty _PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq *
0879 patterns, identifier rest, int lineno, int
0880 col_offset, int end_lineno, int end_col_offset,
0881 PyArena *arena);
0882 pattern_ty _PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns,
0883 asdl_identifier_seq * kwd_attrs, asdl_pattern_seq
0884 * kwd_patterns, int lineno, int col_offset, int
0885 end_lineno, int end_col_offset, PyArena *arena);
0886 pattern_ty _PyAST_MatchStar(identifier name, int lineno, int col_offset, int
0887 end_lineno, int end_col_offset, PyArena *arena);
0888 pattern_ty _PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int
0889 col_offset, int end_lineno, int end_col_offset,
0890 PyArena *arena);
0891 pattern_ty _PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int
0892 col_offset, int end_lineno, int end_col_offset,
0893 PyArena *arena);
0894 type_ignore_ty _PyAST_TypeIgnore(int lineno, string tag, PyArena *arena);
0895 type_param_ty _PyAST_TypeVar(identifier name, expr_ty bound, int lineno, int
0896 col_offset, int end_lineno, int end_col_offset,
0897 PyArena *arena);
0898 type_param_ty _PyAST_ParamSpec(identifier name, int lineno, int col_offset, int
0899 end_lineno, int end_col_offset, PyArena *arena);
0900 type_param_ty _PyAST_TypeVarTuple(identifier name, int lineno, int col_offset,
0901 int end_lineno, int end_col_offset, PyArena
0902 *arena);
0903
0904
0905 PyObject* PyAST_mod2obj(mod_ty t);
0906 mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
0907 int PyAST_Check(PyObject* obj);
0908
0909 extern int _PyAST_Validate(mod_ty);
0910
0911
0912 extern PyObject* _PyAST_ExprAsUnicode(expr_ty);
0913
0914
0915
0916
0917 extern PyObject* _PyAST_GetDocString(asdl_stmt_seq *);
0918
0919 #ifdef __cplusplus
0920 }
0921 #endif
0922 #endif