Debian Codegraph @

Include/internal/pycore_ast.h

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