Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
allendowney
GitHub Repository: allendowney/cpython
Path: blob/main/Include/internal/pycore_ast.h
12 views
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
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, JoinedStr_kind=19, Constant_kind=20,
365
Attribute_kind=21, Subscript_kind=22, Starred_kind=23,
366
Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27};
367
struct _expr {
368
enum _expr_kind kind;
369
union {
370
struct {
371
boolop_ty op;
372
asdl_expr_seq *values;
373
} BoolOp;
374
375
struct {
376
expr_ty target;
377
expr_ty value;
378
} NamedExpr;
379
380
struct {
381
expr_ty left;
382
operator_ty op;
383
expr_ty right;
384
} BinOp;
385
386
struct {
387
unaryop_ty op;
388
expr_ty operand;
389
} UnaryOp;
390
391
struct {
392
arguments_ty args;
393
expr_ty body;
394
} Lambda;
395
396
struct {
397
expr_ty test;
398
expr_ty body;
399
expr_ty orelse;
400
} IfExp;
401
402
struct {
403
asdl_expr_seq *keys;
404
asdl_expr_seq *values;
405
} Dict;
406
407
struct {
408
asdl_expr_seq *elts;
409
} Set;
410
411
struct {
412
expr_ty elt;
413
asdl_comprehension_seq *generators;
414
} ListComp;
415
416
struct {
417
expr_ty elt;
418
asdl_comprehension_seq *generators;
419
} SetComp;
420
421
struct {
422
expr_ty key;
423
expr_ty value;
424
asdl_comprehension_seq *generators;
425
} DictComp;
426
427
struct {
428
expr_ty elt;
429
asdl_comprehension_seq *generators;
430
} GeneratorExp;
431
432
struct {
433
expr_ty value;
434
} Await;
435
436
struct {
437
expr_ty value;
438
} Yield;
439
440
struct {
441
expr_ty value;
442
} YieldFrom;
443
444
struct {
445
expr_ty left;
446
asdl_int_seq *ops;
447
asdl_expr_seq *comparators;
448
} Compare;
449
450
struct {
451
expr_ty func;
452
asdl_expr_seq *args;
453
asdl_keyword_seq *keywords;
454
} Call;
455
456
struct {
457
expr_ty value;
458
int conversion;
459
expr_ty format_spec;
460
} FormattedValue;
461
462
struct {
463
asdl_expr_seq *values;
464
} JoinedStr;
465
466
struct {
467
constant value;
468
string kind;
469
} Constant;
470
471
struct {
472
expr_ty value;
473
identifier attr;
474
expr_context_ty ctx;
475
} Attribute;
476
477
struct {
478
expr_ty value;
479
expr_ty slice;
480
expr_context_ty ctx;
481
} Subscript;
482
483
struct {
484
expr_ty value;
485
expr_context_ty ctx;
486
} Starred;
487
488
struct {
489
identifier id;
490
expr_context_ty ctx;
491
} Name;
492
493
struct {
494
asdl_expr_seq *elts;
495
expr_context_ty ctx;
496
} List;
497
498
struct {
499
asdl_expr_seq *elts;
500
expr_context_ty ctx;
501
} Tuple;
502
503
struct {
504
expr_ty lower;
505
expr_ty upper;
506
expr_ty step;
507
} Slice;
508
509
} v;
510
int lineno;
511
int col_offset;
512
int end_lineno;
513
int end_col_offset;
514
};
515
516
struct _comprehension {
517
expr_ty target;
518
expr_ty iter;
519
asdl_expr_seq *ifs;
520
int is_async;
521
};
522
523
enum _excepthandler_kind {ExceptHandler_kind=1};
524
struct _excepthandler {
525
enum _excepthandler_kind kind;
526
union {
527
struct {
528
expr_ty type;
529
identifier name;
530
asdl_stmt_seq *body;
531
} ExceptHandler;
532
533
} v;
534
int lineno;
535
int col_offset;
536
int end_lineno;
537
int end_col_offset;
538
};
539
540
struct _arguments {
541
asdl_arg_seq *posonlyargs;
542
asdl_arg_seq *args;
543
arg_ty vararg;
544
asdl_arg_seq *kwonlyargs;
545
asdl_expr_seq *kw_defaults;
546
arg_ty kwarg;
547
asdl_expr_seq *defaults;
548
};
549
550
struct _arg {
551
identifier arg;
552
expr_ty annotation;
553
string type_comment;
554
int lineno;
555
int col_offset;
556
int end_lineno;
557
int end_col_offset;
558
};
559
560
struct _keyword {
561
identifier arg;
562
expr_ty value;
563
int lineno;
564
int col_offset;
565
int end_lineno;
566
int end_col_offset;
567
};
568
569
struct _alias {
570
identifier name;
571
identifier asname;
572
int lineno;
573
int col_offset;
574
int end_lineno;
575
int end_col_offset;
576
};
577
578
struct _withitem {
579
expr_ty context_expr;
580
expr_ty optional_vars;
581
};
582
583
struct _match_case {
584
pattern_ty pattern;
585
expr_ty guard;
586
asdl_stmt_seq *body;
587
};
588
589
enum _pattern_kind {MatchValue_kind=1, MatchSingleton_kind=2,
590
MatchSequence_kind=3, MatchMapping_kind=4,
591
MatchClass_kind=5, MatchStar_kind=6, MatchAs_kind=7,
592
MatchOr_kind=8};
593
struct _pattern {
594
enum _pattern_kind kind;
595
union {
596
struct {
597
expr_ty value;
598
} MatchValue;
599
600
struct {
601
constant value;
602
} MatchSingleton;
603
604
struct {
605
asdl_pattern_seq *patterns;
606
} MatchSequence;
607
608
struct {
609
asdl_expr_seq *keys;
610
asdl_pattern_seq *patterns;
611
identifier rest;
612
} MatchMapping;
613
614
struct {
615
expr_ty cls;
616
asdl_pattern_seq *patterns;
617
asdl_identifier_seq *kwd_attrs;
618
asdl_pattern_seq *kwd_patterns;
619
} MatchClass;
620
621
struct {
622
identifier name;
623
} MatchStar;
624
625
struct {
626
pattern_ty pattern;
627
identifier name;
628
} MatchAs;
629
630
struct {
631
asdl_pattern_seq *patterns;
632
} MatchOr;
633
634
} v;
635
int lineno;
636
int col_offset;
637
int end_lineno;
638
int end_col_offset;
639
};
640
641
enum _type_ignore_kind {TypeIgnore_kind=1};
642
struct _type_ignore {
643
enum _type_ignore_kind kind;
644
union {
645
struct {
646
int lineno;
647
string tag;
648
} TypeIgnore;
649
650
} v;
651
};
652
653
enum _type_param_kind {TypeVar_kind=1, ParamSpec_kind=2, TypeVarTuple_kind=3};
654
struct _type_param {
655
enum _type_param_kind kind;
656
union {
657
struct {
658
identifier name;
659
expr_ty bound;
660
} TypeVar;
661
662
struct {
663
identifier name;
664
} ParamSpec;
665
666
struct {
667
identifier name;
668
} TypeVarTuple;
669
670
} v;
671
int lineno;
672
int col_offset;
673
int end_lineno;
674
int end_col_offset;
675
};
676
677
678
// Note: these macros affect function definitions, not only call sites.
679
mod_ty _PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores,
680
PyArena *arena);
681
mod_ty _PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena);
682
mod_ty _PyAST_Expression(expr_ty body, PyArena *arena);
683
mod_ty _PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena
684
*arena);
685
stmt_ty _PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq *
686
body, asdl_expr_seq * decorator_list, expr_ty
687
returns, string type_comment, asdl_type_param_seq *
688
type_params, int lineno, int col_offset, int
689
end_lineno, int end_col_offset, PyArena *arena);
690
stmt_ty _PyAST_AsyncFunctionDef(identifier name, arguments_ty args,
691
asdl_stmt_seq * body, asdl_expr_seq *
692
decorator_list, expr_ty returns, string
693
type_comment, asdl_type_param_seq *
694
type_params, int lineno, int col_offset, int
695
end_lineno, int end_col_offset, PyArena *arena);
696
stmt_ty _PyAST_ClassDef(identifier name, asdl_expr_seq * bases,
697
asdl_keyword_seq * keywords, asdl_stmt_seq * body,
698
asdl_expr_seq * decorator_list, asdl_type_param_seq *
699
type_params, int lineno, int col_offset, int
700
end_lineno, int end_col_offset, PyArena *arena);
701
stmt_ty _PyAST_Return(expr_ty value, int lineno, int col_offset, int
702
end_lineno, int end_col_offset, PyArena *arena);
703
stmt_ty _PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int
704
end_lineno, int end_col_offset, PyArena *arena);
705
stmt_ty _PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string
706
type_comment, int lineno, int col_offset, int end_lineno,
707
int end_col_offset, PyArena *arena);
708
stmt_ty _PyAST_TypeAlias(expr_ty name, asdl_type_param_seq * type_params,
709
expr_ty value, int lineno, int col_offset, int
710
end_lineno, int end_col_offset, PyArena *arena);
711
stmt_ty _PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
712
lineno, int col_offset, int end_lineno, int
713
end_col_offset, PyArena *arena);
714
stmt_ty _PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int
715
simple, int lineno, int col_offset, int end_lineno,
716
int end_col_offset, PyArena *arena);
717
stmt_ty _PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
718
asdl_stmt_seq * orelse, string type_comment, int lineno, int
719
col_offset, int end_lineno, int end_col_offset, PyArena
720
*arena);
721
stmt_ty _PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
722
asdl_stmt_seq * orelse, string type_comment, int
723
lineno, int col_offset, int end_lineno, int
724
end_col_offset, PyArena *arena);
725
stmt_ty _PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq *
726
orelse, int lineno, int col_offset, int end_lineno, int
727
end_col_offset, PyArena *arena);
728
stmt_ty _PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse,
729
int lineno, int col_offset, int end_lineno, int
730
end_col_offset, PyArena *arena);
731
stmt_ty _PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string
732
type_comment, int lineno, int col_offset, int end_lineno,
733
int end_col_offset, PyArena *arena);
734
stmt_ty _PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body,
735
string type_comment, int lineno, int col_offset, int
736
end_lineno, int end_col_offset, PyArena *arena);
737
stmt_ty _PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno,
738
int col_offset, int end_lineno, int end_col_offset,
739
PyArena *arena);
740
stmt_ty _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,
741
int end_lineno, int end_col_offset, PyArena *arena);
742
stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
743
asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int
744
lineno, int col_offset, int end_lineno, int end_col_offset,
745
PyArena *arena);
746
stmt_ty _PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
747
asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int
748
lineno, int col_offset, int end_lineno, int
749
end_col_offset, PyArena *arena);
750
stmt_ty _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
751
int end_lineno, int end_col_offset, PyArena *arena);
752
stmt_ty _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int
753
end_lineno, int end_col_offset, PyArena *arena);
754
stmt_ty _PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level,
755
int lineno, int col_offset, int end_lineno, int
756
end_col_offset, PyArena *arena);
757
stmt_ty _PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset,
758
int end_lineno, int end_col_offset, PyArena *arena);
759
stmt_ty _PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int
760
col_offset, int end_lineno, int end_col_offset, PyArena
761
*arena);
762
stmt_ty _PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno,
763
int end_col_offset, PyArena *arena);
764
stmt_ty _PyAST_Pass(int lineno, int col_offset, int end_lineno, int
765
end_col_offset, PyArena *arena);
766
stmt_ty _PyAST_Break(int lineno, int col_offset, int end_lineno, int
767
end_col_offset, PyArena *arena);
768
stmt_ty _PyAST_Continue(int lineno, int col_offset, int end_lineno, int
769
end_col_offset, PyArena *arena);
770
expr_ty _PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int
771
col_offset, int end_lineno, int end_col_offset, PyArena
772
*arena);
773
expr_ty _PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int
774
col_offset, int end_lineno, int end_col_offset,
775
PyArena *arena);
776
expr_ty _PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno,
777
int col_offset, int end_lineno, int end_col_offset,
778
PyArena *arena);
779
expr_ty _PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int
780
col_offset, int end_lineno, int end_col_offset, PyArena
781
*arena);
782
expr_ty _PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int
783
col_offset, int end_lineno, int end_col_offset, PyArena
784
*arena);
785
expr_ty _PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno,
786
int col_offset, int end_lineno, int end_col_offset,
787
PyArena *arena);
788
expr_ty _PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno,
789
int col_offset, int end_lineno, int end_col_offset, PyArena
790
*arena);
791
expr_ty _PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int
792
end_lineno, int end_col_offset, PyArena *arena);
793
expr_ty _PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int
794
lineno, int col_offset, int end_lineno, int
795
end_col_offset, PyArena *arena);
796
expr_ty _PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int
797
lineno, int col_offset, int end_lineno, int
798
end_col_offset, PyArena *arena);
799
expr_ty _PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq *
800
generators, int lineno, int col_offset, int end_lineno,
801
int end_col_offset, PyArena *arena);
802
expr_ty _PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators,
803
int lineno, int col_offset, int end_lineno, int
804
end_col_offset, PyArena *arena);
805
expr_ty _PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno,
806
int end_col_offset, PyArena *arena);
807
expr_ty _PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno,
808
int end_col_offset, PyArena *arena);
809
expr_ty _PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int
810
end_lineno, int end_col_offset, PyArena *arena);
811
expr_ty _PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq *
812
comparators, int lineno, int col_offset, int end_lineno,
813
int end_col_offset, PyArena *arena);
814
expr_ty _PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq *
815
keywords, int lineno, int col_offset, int end_lineno, int
816
end_col_offset, PyArena *arena);
817
expr_ty _PyAST_FormattedValue(expr_ty value, int conversion, expr_ty
818
format_spec, int lineno, int col_offset, int
819
end_lineno, int end_col_offset, PyArena *arena);
820
expr_ty _PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset,
821
int end_lineno, int end_col_offset, PyArena *arena);
822
expr_ty _PyAST_Constant(constant value, string kind, int lineno, int
823
col_offset, int end_lineno, int end_col_offset, PyArena
824
*arena);
825
expr_ty _PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx,
826
int lineno, int col_offset, int end_lineno, int
827
end_col_offset, PyArena *arena);
828
expr_ty _PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int
829
lineno, int col_offset, int end_lineno, int
830
end_col_offset, PyArena *arena);
831
expr_ty _PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int
832
col_offset, int end_lineno, int end_col_offset, PyArena
833
*arena);
834
expr_ty _PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int
835
col_offset, int end_lineno, int end_col_offset, PyArena
836
*arena);
837
expr_ty _PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
838
col_offset, int end_lineno, int end_col_offset, PyArena
839
*arena);
840
expr_ty _PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
841
col_offset, int end_lineno, int end_col_offset, PyArena
842
*arena);
843
expr_ty _PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno,
844
int col_offset, int end_lineno, int end_col_offset,
845
PyArena *arena);
846
comprehension_ty _PyAST_comprehension(expr_ty target, expr_ty iter,
847
asdl_expr_seq * ifs, int is_async,
848
PyArena *arena);
849
excepthandler_ty _PyAST_ExceptHandler(expr_ty type, identifier name,
850
asdl_stmt_seq * body, int lineno, int
851
col_offset, int end_lineno, int
852
end_col_offset, PyArena *arena);
853
arguments_ty _PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args,
854
arg_ty vararg, asdl_arg_seq * kwonlyargs,
855
asdl_expr_seq * kw_defaults, arg_ty kwarg,
856
asdl_expr_seq * defaults, PyArena *arena);
857
arg_ty _PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int
858
lineno, int col_offset, int end_lineno, int end_col_offset,
859
PyArena *arena);
860
keyword_ty _PyAST_keyword(identifier arg, expr_ty value, int lineno, int
861
col_offset, int end_lineno, int end_col_offset,
862
PyArena *arena);
863
alias_ty _PyAST_alias(identifier name, identifier asname, int lineno, int
864
col_offset, int end_lineno, int end_col_offset, PyArena
865
*arena);
866
withitem_ty _PyAST_withitem(expr_ty context_expr, expr_ty optional_vars,
867
PyArena *arena);
868
match_case_ty _PyAST_match_case(pattern_ty pattern, expr_ty guard,
869
asdl_stmt_seq * body, PyArena *arena);
870
pattern_ty _PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int
871
end_lineno, int end_col_offset, PyArena *arena);
872
pattern_ty _PyAST_MatchSingleton(constant value, int lineno, int col_offset,
873
int end_lineno, int end_col_offset, PyArena
874
*arena);
875
pattern_ty _PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int
876
col_offset, int end_lineno, int end_col_offset,
877
PyArena *arena);
878
pattern_ty _PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq *
879
patterns, identifier rest, int lineno, int
880
col_offset, int end_lineno, int end_col_offset,
881
PyArena *arena);
882
pattern_ty _PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns,
883
asdl_identifier_seq * kwd_attrs, asdl_pattern_seq
884
* kwd_patterns, int lineno, int col_offset, int
885
end_lineno, int end_col_offset, PyArena *arena);
886
pattern_ty _PyAST_MatchStar(identifier name, int lineno, int col_offset, int
887
end_lineno, int end_col_offset, PyArena *arena);
888
pattern_ty _PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int
889
col_offset, int end_lineno, int end_col_offset,
890
PyArena *arena);
891
pattern_ty _PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int
892
col_offset, int end_lineno, int end_col_offset,
893
PyArena *arena);
894
type_ignore_ty _PyAST_TypeIgnore(int lineno, string tag, PyArena *arena);
895
type_param_ty _PyAST_TypeVar(identifier name, expr_ty bound, int lineno, int
896
col_offset, int end_lineno, int end_col_offset,
897
PyArena *arena);
898
type_param_ty _PyAST_ParamSpec(identifier name, int lineno, int col_offset, int
899
end_lineno, int end_col_offset, PyArena *arena);
900
type_param_ty _PyAST_TypeVarTuple(identifier name, int lineno, int col_offset,
901
int end_lineno, int end_col_offset, PyArena
902
*arena);
903
904
905
PyObject* PyAST_mod2obj(mod_ty t);
906
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
907
int PyAST_Check(PyObject* obj);
908
909
extern int _PyAST_Validate(mod_ty);
910
911
/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
912
extern PyObject* _PyAST_ExprAsUnicode(expr_ty);
913
914
/* Return the borrowed reference to the first literal string in the
915
sequence of statements or NULL if it doesn't start from a literal string.
916
Doesn't set exception. */
917
extern PyObject* _PyAST_GetDocString(asdl_stmt_seq *);
918
919
#ifdef __cplusplus
920
}
921
#endif
922
#endif /* !Py_INTERNAL_AST_H */
923
924