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