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