pycore_ast.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. // File automatically generated by Parser/asdl_c.py.
  2. #ifndef Py_INTERNAL_AST_H
  3. #define Py_INTERNAL_AST_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #ifndef Py_BUILD_CORE
  8. # error "this header requires Py_BUILD_CORE define"
  9. #endif
  10. #include "pycore_asdl.h"
  11. typedef struct _mod *mod_ty;
  12. typedef struct _stmt *stmt_ty;
  13. typedef struct _expr *expr_ty;
  14. typedef enum _expr_context { Load=1, Store=2, Del=3 } expr_context_ty;
  15. typedef enum _boolop { And=1, Or=2 } boolop_ty;
  16. typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7,
  17. LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12,
  18. FloorDiv=13 } operator_ty;
  19. typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
  20. typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
  21. In=9, NotIn=10 } cmpop_ty;
  22. typedef struct _comprehension *comprehension_ty;
  23. typedef struct _excepthandler *excepthandler_ty;
  24. typedef struct _arguments *arguments_ty;
  25. typedef struct _arg *arg_ty;
  26. typedef struct _keyword *keyword_ty;
  27. typedef struct _alias *alias_ty;
  28. typedef struct _withitem *withitem_ty;
  29. typedef struct _match_case *match_case_ty;
  30. typedef struct _pattern *pattern_ty;
  31. typedef struct _type_ignore *type_ignore_ty;
  32. typedef struct _type_param *type_param_ty;
  33. typedef struct {
  34. _ASDL_SEQ_HEAD
  35. mod_ty typed_elements[1];
  36. } asdl_mod_seq;
  37. asdl_mod_seq *_Py_asdl_mod_seq_new(Py_ssize_t size, PyArena *arena);
  38. typedef struct {
  39. _ASDL_SEQ_HEAD
  40. stmt_ty typed_elements[1];
  41. } asdl_stmt_seq;
  42. asdl_stmt_seq *_Py_asdl_stmt_seq_new(Py_ssize_t size, PyArena *arena);
  43. typedef struct {
  44. _ASDL_SEQ_HEAD
  45. expr_ty typed_elements[1];
  46. } asdl_expr_seq;
  47. asdl_expr_seq *_Py_asdl_expr_seq_new(Py_ssize_t size, PyArena *arena);
  48. typedef struct {
  49. _ASDL_SEQ_HEAD
  50. comprehension_ty typed_elements[1];
  51. } asdl_comprehension_seq;
  52. asdl_comprehension_seq *_Py_asdl_comprehension_seq_new(Py_ssize_t size, PyArena
  53. *arena);
  54. typedef struct {
  55. _ASDL_SEQ_HEAD
  56. excepthandler_ty typed_elements[1];
  57. } asdl_excepthandler_seq;
  58. asdl_excepthandler_seq *_Py_asdl_excepthandler_seq_new(Py_ssize_t size, PyArena
  59. *arena);
  60. typedef struct {
  61. _ASDL_SEQ_HEAD
  62. arguments_ty typed_elements[1];
  63. } asdl_arguments_seq;
  64. asdl_arguments_seq *_Py_asdl_arguments_seq_new(Py_ssize_t size, PyArena *arena);
  65. typedef struct {
  66. _ASDL_SEQ_HEAD
  67. arg_ty typed_elements[1];
  68. } asdl_arg_seq;
  69. asdl_arg_seq *_Py_asdl_arg_seq_new(Py_ssize_t size, PyArena *arena);
  70. typedef struct {
  71. _ASDL_SEQ_HEAD
  72. keyword_ty typed_elements[1];
  73. } asdl_keyword_seq;
  74. asdl_keyword_seq *_Py_asdl_keyword_seq_new(Py_ssize_t size, PyArena *arena);
  75. typedef struct {
  76. _ASDL_SEQ_HEAD
  77. alias_ty typed_elements[1];
  78. } asdl_alias_seq;
  79. asdl_alias_seq *_Py_asdl_alias_seq_new(Py_ssize_t size, PyArena *arena);
  80. typedef struct {
  81. _ASDL_SEQ_HEAD
  82. withitem_ty typed_elements[1];
  83. } asdl_withitem_seq;
  84. asdl_withitem_seq *_Py_asdl_withitem_seq_new(Py_ssize_t size, PyArena *arena);
  85. typedef struct {
  86. _ASDL_SEQ_HEAD
  87. match_case_ty typed_elements[1];
  88. } asdl_match_case_seq;
  89. asdl_match_case_seq *_Py_asdl_match_case_seq_new(Py_ssize_t size, PyArena
  90. *arena);
  91. typedef struct {
  92. _ASDL_SEQ_HEAD
  93. pattern_ty typed_elements[1];
  94. } asdl_pattern_seq;
  95. asdl_pattern_seq *_Py_asdl_pattern_seq_new(Py_ssize_t size, PyArena *arena);
  96. typedef struct {
  97. _ASDL_SEQ_HEAD
  98. type_ignore_ty typed_elements[1];
  99. } asdl_type_ignore_seq;
  100. asdl_type_ignore_seq *_Py_asdl_type_ignore_seq_new(Py_ssize_t size, PyArena
  101. *arena);
  102. typedef struct {
  103. _ASDL_SEQ_HEAD
  104. type_param_ty typed_elements[1];
  105. } asdl_type_param_seq;
  106. asdl_type_param_seq *_Py_asdl_type_param_seq_new(Py_ssize_t size, PyArena
  107. *arena);
  108. enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
  109. FunctionType_kind=4};
  110. struct _mod {
  111. enum _mod_kind kind;
  112. union {
  113. struct {
  114. asdl_stmt_seq *body;
  115. asdl_type_ignore_seq *type_ignores;
  116. } Module;
  117. struct {
  118. asdl_stmt_seq *body;
  119. } Interactive;
  120. struct {
  121. expr_ty body;
  122. } Expression;
  123. struct {
  124. asdl_expr_seq *argtypes;
  125. expr_ty returns;
  126. } FunctionType;
  127. } v;
  128. };
  129. enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3,
  130. Return_kind=4, Delete_kind=5, Assign_kind=6,
  131. TypeAlias_kind=7, AugAssign_kind=8, AnnAssign_kind=9,
  132. For_kind=10, AsyncFor_kind=11, While_kind=12, If_kind=13,
  133. With_kind=14, AsyncWith_kind=15, Match_kind=16,
  134. Raise_kind=17, Try_kind=18, TryStar_kind=19, Assert_kind=20,
  135. Import_kind=21, ImportFrom_kind=22, Global_kind=23,
  136. Nonlocal_kind=24, Expr_kind=25, Pass_kind=26, Break_kind=27,
  137. Continue_kind=28};
  138. struct _stmt {
  139. enum _stmt_kind kind;
  140. union {
  141. struct {
  142. identifier name;
  143. arguments_ty args;
  144. asdl_stmt_seq *body;
  145. asdl_expr_seq *decorator_list;
  146. expr_ty returns;
  147. string type_comment;
  148. asdl_type_param_seq *type_params;
  149. } FunctionDef;
  150. struct {
  151. identifier name;
  152. arguments_ty args;
  153. asdl_stmt_seq *body;
  154. asdl_expr_seq *decorator_list;
  155. expr_ty returns;
  156. string type_comment;
  157. asdl_type_param_seq *type_params;
  158. } AsyncFunctionDef;
  159. struct {
  160. identifier name;
  161. asdl_expr_seq *bases;
  162. asdl_keyword_seq *keywords;
  163. asdl_stmt_seq *body;
  164. asdl_expr_seq *decorator_list;
  165. asdl_type_param_seq *type_params;
  166. } ClassDef;
  167. struct {
  168. expr_ty value;
  169. } Return;
  170. struct {
  171. asdl_expr_seq *targets;
  172. } Delete;
  173. struct {
  174. asdl_expr_seq *targets;
  175. expr_ty value;
  176. string type_comment;
  177. } Assign;
  178. struct {
  179. expr_ty name;
  180. asdl_type_param_seq *type_params;
  181. expr_ty value;
  182. } TypeAlias;
  183. struct {
  184. expr_ty target;
  185. operator_ty op;
  186. expr_ty value;
  187. } AugAssign;
  188. struct {
  189. expr_ty target;
  190. expr_ty annotation;
  191. expr_ty value;
  192. int simple;
  193. } AnnAssign;
  194. struct {
  195. expr_ty target;
  196. expr_ty iter;
  197. asdl_stmt_seq *body;
  198. asdl_stmt_seq *orelse;
  199. string type_comment;
  200. } For;
  201. struct {
  202. expr_ty target;
  203. expr_ty iter;
  204. asdl_stmt_seq *body;
  205. asdl_stmt_seq *orelse;
  206. string type_comment;
  207. } AsyncFor;
  208. struct {
  209. expr_ty test;
  210. asdl_stmt_seq *body;
  211. asdl_stmt_seq *orelse;
  212. } While;
  213. struct {
  214. expr_ty test;
  215. asdl_stmt_seq *body;
  216. asdl_stmt_seq *orelse;
  217. } If;
  218. struct {
  219. asdl_withitem_seq *items;
  220. asdl_stmt_seq *body;
  221. string type_comment;
  222. } With;
  223. struct {
  224. asdl_withitem_seq *items;
  225. asdl_stmt_seq *body;
  226. string type_comment;
  227. } AsyncWith;
  228. struct {
  229. expr_ty subject;
  230. asdl_match_case_seq *cases;
  231. } Match;
  232. struct {
  233. expr_ty exc;
  234. expr_ty cause;
  235. } Raise;
  236. struct {
  237. asdl_stmt_seq *body;
  238. asdl_excepthandler_seq *handlers;
  239. asdl_stmt_seq *orelse;
  240. asdl_stmt_seq *finalbody;
  241. } Try;
  242. struct {
  243. asdl_stmt_seq *body;
  244. asdl_excepthandler_seq *handlers;
  245. asdl_stmt_seq *orelse;
  246. asdl_stmt_seq *finalbody;
  247. } TryStar;
  248. struct {
  249. expr_ty test;
  250. expr_ty msg;
  251. } Assert;
  252. struct {
  253. asdl_alias_seq *names;
  254. } Import;
  255. struct {
  256. identifier module;
  257. asdl_alias_seq *names;
  258. int level;
  259. } ImportFrom;
  260. struct {
  261. asdl_identifier_seq *names;
  262. } Global;
  263. struct {
  264. asdl_identifier_seq *names;
  265. } Nonlocal;
  266. struct {
  267. expr_ty value;
  268. } Expr;
  269. } v;
  270. int lineno;
  271. int col_offset;
  272. int end_lineno;
  273. int end_col_offset;
  274. };
  275. enum _expr_kind {BoolOp_kind=1, NamedExpr_kind=2, BinOp_kind=3, UnaryOp_kind=4,
  276. Lambda_kind=5, IfExp_kind=6, Dict_kind=7, Set_kind=8,
  277. ListComp_kind=9, SetComp_kind=10, DictComp_kind=11,
  278. GeneratorExp_kind=12, Await_kind=13, Yield_kind=14,
  279. YieldFrom_kind=15, Compare_kind=16, Call_kind=17,
  280. FormattedValue_kind=18, JoinedStr_kind=19, Constant_kind=20,
  281. Attribute_kind=21, Subscript_kind=22, Starred_kind=23,
  282. Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27};
  283. struct _expr {
  284. enum _expr_kind kind;
  285. union {
  286. struct {
  287. boolop_ty op;
  288. asdl_expr_seq *values;
  289. } BoolOp;
  290. struct {
  291. expr_ty target;
  292. expr_ty value;
  293. } NamedExpr;
  294. struct {
  295. expr_ty left;
  296. operator_ty op;
  297. expr_ty right;
  298. } BinOp;
  299. struct {
  300. unaryop_ty op;
  301. expr_ty operand;
  302. } UnaryOp;
  303. struct {
  304. arguments_ty args;
  305. expr_ty body;
  306. } Lambda;
  307. struct {
  308. expr_ty test;
  309. expr_ty body;
  310. expr_ty orelse;
  311. } IfExp;
  312. struct {
  313. asdl_expr_seq *keys;
  314. asdl_expr_seq *values;
  315. } Dict;
  316. struct {
  317. asdl_expr_seq *elts;
  318. } Set;
  319. struct {
  320. expr_ty elt;
  321. asdl_comprehension_seq *generators;
  322. } ListComp;
  323. struct {
  324. expr_ty elt;
  325. asdl_comprehension_seq *generators;
  326. } SetComp;
  327. struct {
  328. expr_ty key;
  329. expr_ty value;
  330. asdl_comprehension_seq *generators;
  331. } DictComp;
  332. struct {
  333. expr_ty elt;
  334. asdl_comprehension_seq *generators;
  335. } GeneratorExp;
  336. struct {
  337. expr_ty value;
  338. } Await;
  339. struct {
  340. expr_ty value;
  341. } Yield;
  342. struct {
  343. expr_ty value;
  344. } YieldFrom;
  345. struct {
  346. expr_ty left;
  347. asdl_int_seq *ops;
  348. asdl_expr_seq *comparators;
  349. } Compare;
  350. struct {
  351. expr_ty func;
  352. asdl_expr_seq *args;
  353. asdl_keyword_seq *keywords;
  354. } Call;
  355. struct {
  356. expr_ty value;
  357. int conversion;
  358. expr_ty format_spec;
  359. } FormattedValue;
  360. struct {
  361. asdl_expr_seq *values;
  362. } JoinedStr;
  363. struct {
  364. constant value;
  365. string kind;
  366. } Constant;
  367. struct {
  368. expr_ty value;
  369. identifier attr;
  370. expr_context_ty ctx;
  371. } Attribute;
  372. struct {
  373. expr_ty value;
  374. expr_ty slice;
  375. expr_context_ty ctx;
  376. } Subscript;
  377. struct {
  378. expr_ty value;
  379. expr_context_ty ctx;
  380. } Starred;
  381. struct {
  382. identifier id;
  383. expr_context_ty ctx;
  384. } Name;
  385. struct {
  386. asdl_expr_seq *elts;
  387. expr_context_ty ctx;
  388. } List;
  389. struct {
  390. asdl_expr_seq *elts;
  391. expr_context_ty ctx;
  392. } Tuple;
  393. struct {
  394. expr_ty lower;
  395. expr_ty upper;
  396. expr_ty step;
  397. } Slice;
  398. } v;
  399. int lineno;
  400. int col_offset;
  401. int end_lineno;
  402. int end_col_offset;
  403. };
  404. struct _comprehension {
  405. expr_ty target;
  406. expr_ty iter;
  407. asdl_expr_seq *ifs;
  408. int is_async;
  409. };
  410. enum _excepthandler_kind {ExceptHandler_kind=1};
  411. struct _excepthandler {
  412. enum _excepthandler_kind kind;
  413. union {
  414. struct {
  415. expr_ty type;
  416. identifier name;
  417. asdl_stmt_seq *body;
  418. } ExceptHandler;
  419. } v;
  420. int lineno;
  421. int col_offset;
  422. int end_lineno;
  423. int end_col_offset;
  424. };
  425. struct _arguments {
  426. asdl_arg_seq *posonlyargs;
  427. asdl_arg_seq *args;
  428. arg_ty vararg;
  429. asdl_arg_seq *kwonlyargs;
  430. asdl_expr_seq *kw_defaults;
  431. arg_ty kwarg;
  432. asdl_expr_seq *defaults;
  433. };
  434. struct _arg {
  435. identifier arg;
  436. expr_ty annotation;
  437. string type_comment;
  438. int lineno;
  439. int col_offset;
  440. int end_lineno;
  441. int end_col_offset;
  442. };
  443. struct _keyword {
  444. identifier arg;
  445. expr_ty value;
  446. int lineno;
  447. int col_offset;
  448. int end_lineno;
  449. int end_col_offset;
  450. };
  451. struct _alias {
  452. identifier name;
  453. identifier asname;
  454. int lineno;
  455. int col_offset;
  456. int end_lineno;
  457. int end_col_offset;
  458. };
  459. struct _withitem {
  460. expr_ty context_expr;
  461. expr_ty optional_vars;
  462. };
  463. struct _match_case {
  464. pattern_ty pattern;
  465. expr_ty guard;
  466. asdl_stmt_seq *body;
  467. };
  468. enum _pattern_kind {MatchValue_kind=1, MatchSingleton_kind=2,
  469. MatchSequence_kind=3, MatchMapping_kind=4,
  470. MatchClass_kind=5, MatchStar_kind=6, MatchAs_kind=7,
  471. MatchOr_kind=8};
  472. struct _pattern {
  473. enum _pattern_kind kind;
  474. union {
  475. struct {
  476. expr_ty value;
  477. } MatchValue;
  478. struct {
  479. constant value;
  480. } MatchSingleton;
  481. struct {
  482. asdl_pattern_seq *patterns;
  483. } MatchSequence;
  484. struct {
  485. asdl_expr_seq *keys;
  486. asdl_pattern_seq *patterns;
  487. identifier rest;
  488. } MatchMapping;
  489. struct {
  490. expr_ty cls;
  491. asdl_pattern_seq *patterns;
  492. asdl_identifier_seq *kwd_attrs;
  493. asdl_pattern_seq *kwd_patterns;
  494. } MatchClass;
  495. struct {
  496. identifier name;
  497. } MatchStar;
  498. struct {
  499. pattern_ty pattern;
  500. identifier name;
  501. } MatchAs;
  502. struct {
  503. asdl_pattern_seq *patterns;
  504. } MatchOr;
  505. } v;
  506. int lineno;
  507. int col_offset;
  508. int end_lineno;
  509. int end_col_offset;
  510. };
  511. enum _type_ignore_kind {TypeIgnore_kind=1};
  512. struct _type_ignore {
  513. enum _type_ignore_kind kind;
  514. union {
  515. struct {
  516. int lineno;
  517. string tag;
  518. } TypeIgnore;
  519. } v;
  520. };
  521. enum _type_param_kind {TypeVar_kind=1, ParamSpec_kind=2, TypeVarTuple_kind=3};
  522. struct _type_param {
  523. enum _type_param_kind kind;
  524. union {
  525. struct {
  526. identifier name;
  527. expr_ty bound;
  528. } TypeVar;
  529. struct {
  530. identifier name;
  531. } ParamSpec;
  532. struct {
  533. identifier name;
  534. } TypeVarTuple;
  535. } v;
  536. int lineno;
  537. int col_offset;
  538. int end_lineno;
  539. int end_col_offset;
  540. };
  541. // Note: these macros affect function definitions, not only call sites.
  542. mod_ty _PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores,
  543. PyArena *arena);
  544. mod_ty _PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena);
  545. mod_ty _PyAST_Expression(expr_ty body, PyArena *arena);
  546. mod_ty _PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena
  547. *arena);
  548. stmt_ty _PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq *
  549. body, asdl_expr_seq * decorator_list, expr_ty
  550. returns, string type_comment, asdl_type_param_seq *
  551. type_params, int lineno, int col_offset, int
  552. end_lineno, int end_col_offset, PyArena *arena);
  553. stmt_ty _PyAST_AsyncFunctionDef(identifier name, arguments_ty args,
  554. asdl_stmt_seq * body, asdl_expr_seq *
  555. decorator_list, expr_ty returns, string
  556. type_comment, asdl_type_param_seq *
  557. type_params, int lineno, int col_offset, int
  558. end_lineno, int end_col_offset, PyArena *arena);
  559. stmt_ty _PyAST_ClassDef(identifier name, asdl_expr_seq * bases,
  560. asdl_keyword_seq * keywords, asdl_stmt_seq * body,
  561. asdl_expr_seq * decorator_list, asdl_type_param_seq *
  562. type_params, int lineno, int col_offset, int
  563. end_lineno, int end_col_offset, PyArena *arena);
  564. stmt_ty _PyAST_Return(expr_ty value, int lineno, int col_offset, int
  565. end_lineno, int end_col_offset, PyArena *arena);
  566. stmt_ty _PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int
  567. end_lineno, int end_col_offset, PyArena *arena);
  568. stmt_ty _PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string
  569. type_comment, int lineno, int col_offset, int end_lineno,
  570. int end_col_offset, PyArena *arena);
  571. stmt_ty _PyAST_TypeAlias(expr_ty name, asdl_type_param_seq * type_params,
  572. expr_ty value, int lineno, int col_offset, int
  573. end_lineno, int end_col_offset, PyArena *arena);
  574. stmt_ty _PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
  575. lineno, int col_offset, int end_lineno, int
  576. end_col_offset, PyArena *arena);
  577. stmt_ty _PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int
  578. simple, int lineno, int col_offset, int end_lineno,
  579. int end_col_offset, PyArena *arena);
  580. stmt_ty _PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
  581. asdl_stmt_seq * orelse, string type_comment, int lineno, int
  582. col_offset, int end_lineno, int end_col_offset, PyArena
  583. *arena);
  584. stmt_ty _PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
  585. asdl_stmt_seq * orelse, string type_comment, int
  586. lineno, int col_offset, int end_lineno, int
  587. end_col_offset, PyArena *arena);
  588. stmt_ty _PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq *
  589. orelse, int lineno, int col_offset, int end_lineno, int
  590. end_col_offset, PyArena *arena);
  591. stmt_ty _PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse,
  592. int lineno, int col_offset, int end_lineno, int
  593. end_col_offset, PyArena *arena);
  594. stmt_ty _PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string
  595. type_comment, int lineno, int col_offset, int end_lineno,
  596. int end_col_offset, PyArena *arena);
  597. stmt_ty _PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body,
  598. string type_comment, int lineno, int col_offset, int
  599. end_lineno, int end_col_offset, PyArena *arena);
  600. stmt_ty _PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno,
  601. int col_offset, int end_lineno, int end_col_offset,
  602. PyArena *arena);
  603. stmt_ty _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,
  604. int end_lineno, int end_col_offset, PyArena *arena);
  605. stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
  606. asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int
  607. lineno, int col_offset, int end_lineno, int end_col_offset,
  608. PyArena *arena);
  609. stmt_ty _PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
  610. asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int
  611. lineno, int col_offset, int end_lineno, int
  612. end_col_offset, PyArena *arena);
  613. stmt_ty _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
  614. int end_lineno, int end_col_offset, PyArena *arena);
  615. stmt_ty _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int
  616. end_lineno, int end_col_offset, PyArena *arena);
  617. stmt_ty _PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level,
  618. int lineno, int col_offset, int end_lineno, int
  619. end_col_offset, PyArena *arena);
  620. stmt_ty _PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset,
  621. int end_lineno, int end_col_offset, PyArena *arena);
  622. stmt_ty _PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int
  623. col_offset, int end_lineno, int end_col_offset, PyArena
  624. *arena);
  625. stmt_ty _PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno,
  626. int end_col_offset, PyArena *arena);
  627. stmt_ty _PyAST_Pass(int lineno, int col_offset, int end_lineno, int
  628. end_col_offset, PyArena *arena);
  629. stmt_ty _PyAST_Break(int lineno, int col_offset, int end_lineno, int
  630. end_col_offset, PyArena *arena);
  631. stmt_ty _PyAST_Continue(int lineno, int col_offset, int end_lineno, int
  632. end_col_offset, PyArena *arena);
  633. expr_ty _PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int
  634. col_offset, int end_lineno, int end_col_offset, PyArena
  635. *arena);
  636. expr_ty _PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int
  637. col_offset, int end_lineno, int end_col_offset,
  638. PyArena *arena);
  639. expr_ty _PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno,
  640. int col_offset, int end_lineno, int end_col_offset,
  641. PyArena *arena);
  642. expr_ty _PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int
  643. col_offset, int end_lineno, int end_col_offset, PyArena
  644. *arena);
  645. expr_ty _PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int
  646. col_offset, int end_lineno, int end_col_offset, PyArena
  647. *arena);
  648. expr_ty _PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno,
  649. int col_offset, int end_lineno, int end_col_offset,
  650. PyArena *arena);
  651. expr_ty _PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno,
  652. int col_offset, int end_lineno, int end_col_offset, PyArena
  653. *arena);
  654. expr_ty _PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int
  655. end_lineno, int end_col_offset, PyArena *arena);
  656. expr_ty _PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int
  657. lineno, int col_offset, int end_lineno, int
  658. end_col_offset, PyArena *arena);
  659. expr_ty _PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int
  660. lineno, int col_offset, int end_lineno, int
  661. end_col_offset, PyArena *arena);
  662. expr_ty _PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq *
  663. generators, int lineno, int col_offset, int end_lineno,
  664. int end_col_offset, PyArena *arena);
  665. expr_ty _PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators,
  666. int lineno, int col_offset, int end_lineno, int
  667. end_col_offset, PyArena *arena);
  668. expr_ty _PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno,
  669. int end_col_offset, PyArena *arena);
  670. expr_ty _PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno,
  671. int end_col_offset, PyArena *arena);
  672. expr_ty _PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int
  673. end_lineno, int end_col_offset, PyArena *arena);
  674. expr_ty _PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq *
  675. comparators, int lineno, int col_offset, int end_lineno,
  676. int end_col_offset, PyArena *arena);
  677. expr_ty _PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq *
  678. keywords, int lineno, int col_offset, int end_lineno, int
  679. end_col_offset, PyArena *arena);
  680. expr_ty _PyAST_FormattedValue(expr_ty value, int conversion, expr_ty
  681. format_spec, int lineno, int col_offset, int
  682. end_lineno, int end_col_offset, PyArena *arena);
  683. expr_ty _PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset,
  684. int end_lineno, int end_col_offset, PyArena *arena);
  685. expr_ty _PyAST_Constant(constant value, string kind, int lineno, int
  686. col_offset, int end_lineno, int end_col_offset, PyArena
  687. *arena);
  688. expr_ty _PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx,
  689. int lineno, int col_offset, int end_lineno, int
  690. end_col_offset, PyArena *arena);
  691. expr_ty _PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int
  692. lineno, int col_offset, int end_lineno, int
  693. end_col_offset, PyArena *arena);
  694. expr_ty _PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int
  695. col_offset, int end_lineno, int end_col_offset, PyArena
  696. *arena);
  697. expr_ty _PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int
  698. col_offset, int end_lineno, int end_col_offset, PyArena
  699. *arena);
  700. expr_ty _PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
  701. col_offset, int end_lineno, int end_col_offset, PyArena
  702. *arena);
  703. expr_ty _PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
  704. col_offset, int end_lineno, int end_col_offset, PyArena
  705. *arena);
  706. expr_ty _PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno,
  707. int col_offset, int end_lineno, int end_col_offset,
  708. PyArena *arena);
  709. comprehension_ty _PyAST_comprehension(expr_ty target, expr_ty iter,
  710. asdl_expr_seq * ifs, int is_async,
  711. PyArena *arena);
  712. excepthandler_ty _PyAST_ExceptHandler(expr_ty type, identifier name,
  713. asdl_stmt_seq * body, int lineno, int
  714. col_offset, int end_lineno, int
  715. end_col_offset, PyArena *arena);
  716. arguments_ty _PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args,
  717. arg_ty vararg, asdl_arg_seq * kwonlyargs,
  718. asdl_expr_seq * kw_defaults, arg_ty kwarg,
  719. asdl_expr_seq * defaults, PyArena *arena);
  720. arg_ty _PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int
  721. lineno, int col_offset, int end_lineno, int end_col_offset,
  722. PyArena *arena);
  723. keyword_ty _PyAST_keyword(identifier arg, expr_ty value, int lineno, int
  724. col_offset, int end_lineno, int end_col_offset,
  725. PyArena *arena);
  726. alias_ty _PyAST_alias(identifier name, identifier asname, int lineno, int
  727. col_offset, int end_lineno, int end_col_offset, PyArena
  728. *arena);
  729. withitem_ty _PyAST_withitem(expr_ty context_expr, expr_ty optional_vars,
  730. PyArena *arena);
  731. match_case_ty _PyAST_match_case(pattern_ty pattern, expr_ty guard,
  732. asdl_stmt_seq * body, PyArena *arena);
  733. pattern_ty _PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int
  734. end_lineno, int end_col_offset, PyArena *arena);
  735. pattern_ty _PyAST_MatchSingleton(constant value, int lineno, int col_offset,
  736. int end_lineno, int end_col_offset, PyArena
  737. *arena);
  738. pattern_ty _PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int
  739. col_offset, int end_lineno, int end_col_offset,
  740. PyArena *arena);
  741. pattern_ty _PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq *
  742. patterns, identifier rest, int lineno, int
  743. col_offset, int end_lineno, int end_col_offset,
  744. PyArena *arena);
  745. pattern_ty _PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns,
  746. asdl_identifier_seq * kwd_attrs, asdl_pattern_seq
  747. * kwd_patterns, int lineno, int col_offset, int
  748. end_lineno, int end_col_offset, PyArena *arena);
  749. pattern_ty _PyAST_MatchStar(identifier name, int lineno, int col_offset, int
  750. end_lineno, int end_col_offset, PyArena *arena);
  751. pattern_ty _PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int
  752. col_offset, int end_lineno, int end_col_offset,
  753. PyArena *arena);
  754. pattern_ty _PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int
  755. col_offset, int end_lineno, int end_col_offset,
  756. PyArena *arena);
  757. type_ignore_ty _PyAST_TypeIgnore(int lineno, string tag, PyArena *arena);
  758. type_param_ty _PyAST_TypeVar(identifier name, expr_ty bound, int lineno, int
  759. col_offset, int end_lineno, int end_col_offset,
  760. PyArena *arena);
  761. type_param_ty _PyAST_ParamSpec(identifier name, int lineno, int col_offset, int
  762. end_lineno, int end_col_offset, PyArena *arena);
  763. type_param_ty _PyAST_TypeVarTuple(identifier name, int lineno, int col_offset,
  764. int end_lineno, int end_col_offset, PyArena
  765. *arena);
  766. PyObject* PyAST_mod2obj(mod_ty t);
  767. mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
  768. int PyAST_Check(PyObject* obj);
  769. extern int _PyAST_Validate(mod_ty);
  770. /* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
  771. extern PyObject* _PyAST_ExprAsUnicode(expr_ty);
  772. /* Return the borrowed reference to the first literal string in the
  773. sequence of statements or NULL if it doesn't start from a literal string.
  774. Doesn't set exception. */
  775. extern PyObject* _PyAST_GetDocString(asdl_stmt_seq *);
  776. #ifdef __cplusplus
  777. }
  778. #endif
  779. #endif /* !Py_INTERNAL_AST_H */