|
35742
|
1 /* File automatically generated by ../Parser/asdl_c.py */
|
|
|
2
|
|
|
3 #include "asdl.h"
|
|
|
4
|
|
|
5 typedef struct _mod *mod_ty;
|
|
|
6
|
|
|
7 typedef struct _stmt *stmt_ty;
|
|
|
8
|
|
|
9 typedef struct _expr *expr_ty;
|
|
|
10
|
|
|
11 typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5,
|
|
|
12 Param=6 } expr_context_ty;
|
|
|
13
|
|
|
14 typedef struct _slice *slice_ty;
|
|
|
15
|
|
|
16 typedef enum _boolop { And=1, Or=2 } boolop_ty;
|
|
|
17
|
|
|
18 typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7,
|
|
|
19 RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 }
|
|
|
20 operator_ty;
|
|
|
21
|
|
|
22 typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
|
|
|
23
|
|
|
24 typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
|
|
|
25 In=9, NotIn=10 } cmpop_ty;
|
|
|
26
|
|
|
27 typedef struct _comprehension *comprehension_ty;
|
|
|
28
|
|
|
29 typedef struct _excepthandler *excepthandler_ty;
|
|
|
30
|
|
|
31 typedef struct _arguments *arguments_ty;
|
|
|
32
|
|
|
33 typedef struct _keyword *keyword_ty;
|
|
|
34
|
|
|
35 typedef struct _alias *alias_ty;
|
|
|
36
|
|
|
37 struct _mod {
|
|
|
38 enum { Module_kind=1, Interactive_kind=2, Expression_kind=3,
|
|
|
39 Suite_kind=4 } kind;
|
|
|
40 union {
|
|
|
41 struct {
|
|
|
42 asdl_seq *body;
|
|
|
43 } Module;
|
|
|
44
|
|
|
45 struct {
|
|
|
46 asdl_seq *body;
|
|
|
47 } Interactive;
|
|
|
48
|
|
|
49 struct {
|
|
|
50 expr_ty body;
|
|
|
51 } Expression;
|
|
|
52
|
|
|
53 struct {
|
|
|
54 asdl_seq *body;
|
|
|
55 } Suite;
|
|
|
56
|
|
|
57 } v;
|
|
|
58 };
|
|
|
59
|
|
|
60 struct _stmt {
|
|
|
61 enum { FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3,
|
|
|
62 Delete_kind=4, Assign_kind=5, AugAssign_kind=6, Print_kind=7,
|
|
|
63 For_kind=8, While_kind=9, If_kind=10, Raise_kind=11,
|
|
|
64 TryExcept_kind=12, TryFinally_kind=13, Assert_kind=14,
|
|
|
65 Import_kind=15, ImportFrom_kind=16, Exec_kind=17,
|
|
|
66 Global_kind=18, Expr_kind=19, Pass_kind=20, Break_kind=21,
|
|
|
67 Continue_kind=22 } kind;
|
|
|
68 union {
|
|
|
69 struct {
|
|
|
70 identifier name;
|
|
|
71 arguments_ty args;
|
|
|
72 asdl_seq *body;
|
|
|
73 asdl_seq *decorators;
|
|
|
74 } FunctionDef;
|
|
|
75
|
|
|
76 struct {
|
|
|
77 identifier name;
|
|
|
78 asdl_seq *bases;
|
|
|
79 asdl_seq *body;
|
|
|
80 } ClassDef;
|
|
|
81
|
|
|
82 struct {
|
|
|
83 expr_ty value;
|
|
|
84 } Return;
|
|
|
85
|
|
|
86 struct {
|
|
|
87 asdl_seq *targets;
|
|
|
88 } Delete;
|
|
|
89
|
|
|
90 struct {
|
|
|
91 asdl_seq *targets;
|
|
|
92 expr_ty value;
|
|
|
93 } Assign;
|
|
|
94
|
|
|
95 struct {
|
|
|
96 expr_ty target;
|
|
|
97 operator_ty op;
|
|
|
98 expr_ty value;
|
|
|
99 } AugAssign;
|
|
|
100
|
|
|
101 struct {
|
|
|
102 expr_ty dest;
|
|
|
103 asdl_seq *values;
|
|
|
104 bool nl;
|
|
|
105 } Print;
|
|
|
106
|
|
|
107 struct {
|
|
|
108 expr_ty target;
|
|
|
109 expr_ty iter;
|
|
|
110 asdl_seq *body;
|
|
|
111 asdl_seq *orelse;
|
|
|
112 } For;
|
|
|
113
|
|
|
114 struct {
|
|
|
115 expr_ty test;
|
|
|
116 asdl_seq *body;
|
|
|
117 asdl_seq *orelse;
|
|
|
118 } While;
|
|
|
119
|
|
|
120 struct {
|
|
|
121 expr_ty test;
|
|
|
122 asdl_seq *body;
|
|
|
123 asdl_seq *orelse;
|
|
|
124 } If;
|
|
|
125
|
|
|
126 struct {
|
|
|
127 expr_ty type;
|
|
|
128 expr_ty inst;
|
|
|
129 expr_ty tback;
|
|
|
130 } Raise;
|
|
|
131
|
|
|
132 struct {
|
|
|
133 asdl_seq *body;
|
|
|
134 asdl_seq *handlers;
|
|
|
135 asdl_seq *orelse;
|
|
|
136 } TryExcept;
|
|
|
137
|
|
|
138 struct {
|
|
|
139 asdl_seq *body;
|
|
|
140 asdl_seq *finalbody;
|
|
|
141 } TryFinally;
|
|
|
142
|
|
|
143 struct {
|
|
|
144 expr_ty test;
|
|
|
145 expr_ty msg;
|
|
|
146 } Assert;
|
|
|
147
|
|
|
148 struct {
|
|
|
149 asdl_seq *names;
|
|
|
150 } Import;
|
|
|
151
|
|
|
152 struct {
|
|
|
153 identifier module;
|
|
|
154 asdl_seq *names;
|
|
|
155 } ImportFrom;
|
|
|
156
|
|
|
157 struct {
|
|
|
158 expr_ty body;
|
|
|
159 expr_ty globals;
|
|
|
160 expr_ty locals;
|
|
|
161 } Exec;
|
|
|
162
|
|
|
163 struct {
|
|
|
164 asdl_seq *names;
|
|
|
165 } Global;
|
|
|
166
|
|
|
167 struct {
|
|
|
168 expr_ty value;
|
|
|
169 } Expr;
|
|
|
170
|
|
|
171 } v;
|
|
|
172 int lineno;
|
|
|
173 };
|
|
|
174
|
|
|
175 struct _expr {
|
|
|
176 enum { BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
|
|
|
177 Dict_kind=5, ListComp_kind=6, GeneratorExp_kind=7, Yield_kind=8,
|
|
|
178 Compare_kind=9, Call_kind=10, Repr_kind=11, Num_kind=12,
|
|
|
179 Str_kind=13, Attribute_kind=14, Subscript_kind=15, Name_kind=16,
|
|
|
180 List_kind=17, Tuple_kind=18 } kind;
|
|
|
181 union {
|
|
|
182 struct {
|
|
|
183 boolop_ty op;
|
|
|
184 asdl_seq *values;
|
|
|
185 } BoolOp;
|
|
|
186
|
|
|
187 struct {
|
|
|
188 expr_ty left;
|
|
|
189 operator_ty op;
|
|
|
190 expr_ty right;
|
|
|
191 } BinOp;
|
|
|
192
|
|
|
193 struct {
|
|
|
194 unaryop_ty op;
|
|
|
195 expr_ty operand;
|
|
|
196 } UnaryOp;
|
|
|
197
|
|
|
198 struct {
|
|
|
199 arguments_ty args;
|
|
|
200 expr_ty body;
|
|
|
201 } Lambda;
|
|
|
202
|
|
|
203 struct {
|
|
|
204 asdl_seq *keys;
|
|
|
205 asdl_seq *values;
|
|
|
206 } Dict;
|
|
|
207
|
|
|
208 struct {
|
|
|
209 expr_ty elt;
|
|
|
210 asdl_seq *generators;
|
|
|
211 } ListComp;
|
|
|
212
|
|
|
213 struct {
|
|
|
214 expr_ty elt;
|
|
|
215 asdl_seq *generators;
|
|
|
216 } GeneratorExp;
|
|
|
217
|
|
|
218 struct {
|
|
|
219 expr_ty value;
|
|
|
220 } Yield;
|
|
|
221
|
|
|
222 struct {
|
|
|
223 expr_ty left;
|
|
|
224 asdl_seq *ops;
|
|
|
225 asdl_seq *comparators;
|
|
|
226 } Compare;
|
|
|
227
|
|
|
228 struct {
|
|
|
229 expr_ty func;
|
|
|
230 asdl_seq *args;
|
|
|
231 asdl_seq *keywords;
|
|
|
232 expr_ty starargs;
|
|
|
233 expr_ty kwargs;
|
|
|
234 } Call;
|
|
|
235
|
|
|
236 struct {
|
|
|
237 expr_ty value;
|
|
|
238 } Repr;
|
|
|
239
|
|
|
240 struct {
|
|
|
241 object n;
|
|
|
242 } Num;
|
|
|
243
|
|
|
244 struct {
|
|
|
245 string s;
|
|
|
246 } Str;
|
|
|
247
|
|
|
248 struct {
|
|
|
249 expr_ty value;
|
|
|
250 identifier attr;
|
|
|
251 expr_context_ty ctx;
|
|
|
252 } Attribute;
|
|
|
253
|
|
|
254 struct {
|
|
|
255 expr_ty value;
|
|
|
256 slice_ty slice;
|
|
|
257 expr_context_ty ctx;
|
|
|
258 } Subscript;
|
|
|
259
|
|
|
260 struct {
|
|
|
261 identifier id;
|
|
|
262 expr_context_ty ctx;
|
|
|
263 } Name;
|
|
|
264
|
|
|
265 struct {
|
|
|
266 asdl_seq *elts;
|
|
|
267 expr_context_ty ctx;
|
|
|
268 } List;
|
|
|
269
|
|
|
270 struct {
|
|
|
271 asdl_seq *elts;
|
|
|
272 expr_context_ty ctx;
|
|
|
273 } Tuple;
|
|
|
274
|
|
|
275 } v;
|
|
|
276 int lineno;
|
|
|
277 };
|
|
|
278
|
|
|
279 struct _slice {
|
|
|
280 enum { Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4 }
|
|
|
281 kind;
|
|
|
282 union {
|
|
|
283 struct {
|
|
|
284 expr_ty lower;
|
|
|
285 expr_ty upper;
|
|
|
286 expr_ty step;
|
|
|
287 } Slice;
|
|
|
288
|
|
|
289 struct {
|
|
|
290 asdl_seq *dims;
|
|
|
291 } ExtSlice;
|
|
|
292
|
|
|
293 struct {
|
|
|
294 expr_ty value;
|
|
|
295 } Index;
|
|
|
296
|
|
|
297 } v;
|
|
|
298 };
|
|
|
299
|
|
|
300 struct _comprehension {
|
|
|
301 expr_ty target;
|
|
|
302 expr_ty iter;
|
|
|
303 asdl_seq *ifs;
|
|
|
304 };
|
|
|
305
|
|
|
306 struct _excepthandler {
|
|
|
307 expr_ty type;
|
|
|
308 expr_ty name;
|
|
|
309 asdl_seq *body;
|
|
|
310 };
|
|
|
311
|
|
|
312 struct _arguments {
|
|
|
313 asdl_seq *args;
|
|
|
314 identifier vararg;
|
|
|
315 identifier kwarg;
|
|
|
316 asdl_seq *defaults;
|
|
|
317 };
|
|
|
318
|
|
|
319 struct _keyword {
|
|
|
320 identifier arg;
|
|
|
321 expr_ty value;
|
|
|
322 };
|
|
|
323
|
|
|
324 struct _alias {
|
|
|
325 identifier name;
|
|
|
326 identifier asname;
|
|
|
327 };
|
|
|
328
|
|
|
329 mod_ty Module(asdl_seq * body);
|
|
|
330 mod_ty Interactive(asdl_seq * body);
|
|
|
331 mod_ty Expression(expr_ty body);
|
|
|
332 mod_ty Suite(asdl_seq * body);
|
|
|
333 stmt_ty FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
|
|
|
334 asdl_seq * decorators, int lineno);
|
|
|
335 stmt_ty ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int
|
|
|
336 lineno);
|
|
|
337 stmt_ty Return(expr_ty value, int lineno);
|
|
|
338 stmt_ty Delete(asdl_seq * targets, int lineno);
|
|
|
339 stmt_ty Assign(asdl_seq * targets, expr_ty value, int lineno);
|
|
|
340 stmt_ty AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno);
|
|
|
341 stmt_ty Print(expr_ty dest, asdl_seq * values, bool nl, int lineno);
|
|
|
342 stmt_ty For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,
|
|
|
343 int lineno);
|
|
|
344 stmt_ty While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno);
|
|
|
345 stmt_ty If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno);
|
|
|
346 stmt_ty Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno);
|
|
|
347 stmt_ty TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int
|
|
|
348 lineno);
|
|
|
349 stmt_ty TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno);
|
|
|
350 stmt_ty Assert(expr_ty test, expr_ty msg, int lineno);
|
|
|
351 stmt_ty Import(asdl_seq * names, int lineno);
|
|
|
352 stmt_ty ImportFrom(identifier module, asdl_seq * names, int lineno);
|
|
|
353 stmt_ty Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno);
|
|
|
354 stmt_ty Global(asdl_seq * names, int lineno);
|
|
|
355 stmt_ty Expr(expr_ty value, int lineno);
|
|
|
356 stmt_ty Pass(int lineno);
|
|
|
357 stmt_ty Break(int lineno);
|
|
|
358 stmt_ty Continue(int lineno);
|
|
|
359 expr_ty BoolOp(boolop_ty op, asdl_seq * values, int lineno);
|
|
|
360 expr_ty BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno);
|
|
|
361 expr_ty UnaryOp(unaryop_ty op, expr_ty operand, int lineno);
|
|
|
362 expr_ty Lambda(arguments_ty args, expr_ty body, int lineno);
|
|
|
363 expr_ty Dict(asdl_seq * keys, asdl_seq * values, int lineno);
|
|
|
364 expr_ty ListComp(expr_ty elt, asdl_seq * generators, int lineno);
|
|
|
365 expr_ty GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno);
|
|
|
366 expr_ty Yield(expr_ty value, int lineno);
|
|
|
367 expr_ty Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators, int
|
|
|
368 lineno);
|
|
|
369 expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
|
|
|
370 starargs, expr_ty kwargs, int lineno);
|
|
|
371 expr_ty Repr(expr_ty value, int lineno);
|
|
|
372 expr_ty Num(object n, int lineno);
|
|
|
373 expr_ty Str(string s, int lineno);
|
|
|
374 expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
|
|
|
375 lineno);
|
|
|
376 expr_ty Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
|
|
|
377 lineno);
|
|
|
378 expr_ty Name(identifier id, expr_context_ty ctx, int lineno);
|
|
|
379 expr_ty List(asdl_seq * elts, expr_context_ty ctx, int lineno);
|
|
|
380 expr_ty Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno);
|
|
|
381 slice_ty Ellipsis(void);
|
|
|
382 slice_ty Slice(expr_ty lower, expr_ty upper, expr_ty step);
|
|
|
383 slice_ty ExtSlice(asdl_seq * dims);
|
|
|
384 slice_ty Index(expr_ty value);
|
|
|
385 comprehension_ty comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs);
|
|
|
386 excepthandler_ty excepthandler(expr_ty type, expr_ty name, asdl_seq * body);
|
|
|
387 arguments_ty arguments(asdl_seq * args, identifier vararg, identifier kwarg,
|
|
|
388 asdl_seq * defaults);
|
|
|
389 keyword_ty keyword(identifier arg, expr_ty value);
|
|
|
390 alias_ty alias(identifier name, identifier asname);
|
|
|
391 void free_mod(mod_ty);
|
|
|
392 void free_stmt(stmt_ty);
|
|
|
393 void free_expr(expr_ty);
|
|
|
394 void free_expr_context(expr_context_ty);
|
|
|
395 void free_slice(slice_ty);
|
|
|
396 void free_boolop(boolop_ty);
|
|
|
397 void free_operator(operator_ty);
|
|
|
398 void free_unaryop(unaryop_ty);
|
|
|
399 void free_cmpop(cmpop_ty);
|
|
|
400 void free_comprehension(comprehension_ty);
|
|
|
401 void free_excepthandler(excepthandler_ty);
|
|
|
402 void free_arguments(arguments_ty);
|
|
|
403 void free_keyword(keyword_ty);
|
|
|
404 void free_alias(alias_ty);
|
|
|
405 int marshal_write_mod(PyObject **, int *, mod_ty);
|
|
|
406 int marshal_write_stmt(PyObject **, int *, stmt_ty);
|
|
|
407 int marshal_write_expr(PyObject **, int *, expr_ty);
|
|
|
408 int marshal_write_expr_context(PyObject **, int *, expr_context_ty);
|
|
|
409 int marshal_write_slice(PyObject **, int *, slice_ty);
|
|
|
410 int marshal_write_boolop(PyObject **, int *, boolop_ty);
|
|
|
411 int marshal_write_operator(PyObject **, int *, operator_ty);
|
|
|
412 int marshal_write_unaryop(PyObject **, int *, unaryop_ty);
|
|
|
413 int marshal_write_cmpop(PyObject **, int *, cmpop_ty);
|
|
|
414 int marshal_write_comprehension(PyObject **, int *, comprehension_ty);
|
|
|
415 int marshal_write_excepthandler(PyObject **, int *, excepthandler_ty);
|
|
|
416 int marshal_write_arguments(PyObject **, int *, arguments_ty);
|
|
|
417 int marshal_write_keyword(PyObject **, int *, keyword_ty);
|
|
|
418 int marshal_write_alias(PyObject **, int *, alias_ty);
|