blob: 9609141c046665821690b31968701a990cbd3e53 [file] [log] [blame]
Neal Norwitz6576bd82005-11-13 18:41:28 +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
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000331mod_ty Module(asdl_seq * body);
332mod_ty Interactive(asdl_seq * body);
333mod_ty Expression(expr_ty body);
334mod_ty Suite(asdl_seq * body);
335stmt_ty FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
336 asdl_seq * decorators, int lineno);
337stmt_ty ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int
338 lineno);
339stmt_ty Return(expr_ty value, int lineno);
340stmt_ty Delete(asdl_seq * targets, int lineno);
341stmt_ty Assign(asdl_seq * targets, expr_ty value, int lineno);
342stmt_ty AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno);
343stmt_ty Print(expr_ty dest, asdl_seq * values, bool nl, int lineno);
344stmt_ty For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,
345 int lineno);
346stmt_ty While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno);
347stmt_ty If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno);
348stmt_ty Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno);
349stmt_ty TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int
350 lineno);
351stmt_ty TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno);
352stmt_ty Assert(expr_ty test, expr_ty msg, int lineno);
353stmt_ty Import(asdl_seq * names, int lineno);
354stmt_ty ImportFrom(identifier module, asdl_seq * names, int lineno);
355stmt_ty Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno);
356stmt_ty Global(asdl_seq * names, int lineno);
357stmt_ty Expr(expr_ty value, int lineno);
358stmt_ty Pass(int lineno);
359stmt_ty Break(int lineno);
360stmt_ty Continue(int lineno);
361expr_ty BoolOp(boolop_ty op, asdl_seq * values, int lineno);
362expr_ty BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno);
363expr_ty UnaryOp(unaryop_ty op, expr_ty operand, int lineno);
364expr_ty Lambda(arguments_ty args, expr_ty body, int lineno);
365expr_ty Dict(asdl_seq * keys, asdl_seq * values, int lineno);
366expr_ty ListComp(expr_ty elt, asdl_seq * generators, int lineno);
367expr_ty GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno);
368expr_ty Yield(expr_ty value, int lineno);
369expr_ty Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators, int
370 lineno);
371expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
372 starargs, expr_ty kwargs, int lineno);
373expr_ty Repr(expr_ty value, int lineno);
374expr_ty Num(object n, int lineno);
375expr_ty Str(string s, int lineno);
376expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
377 lineno);
378expr_ty Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
379 lineno);
380expr_ty Name(identifier id, expr_context_ty ctx, int lineno);
381expr_ty List(asdl_seq * elts, expr_context_ty ctx, int lineno);
382expr_ty Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno);
383slice_ty Ellipsis(void);
384slice_ty Slice(expr_ty lower, expr_ty upper, expr_ty step);
385slice_ty ExtSlice(asdl_seq * dims);
386slice_ty Index(expr_ty value);
387comprehension_ty comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs);
388excepthandler_ty excepthandler(expr_ty type, expr_ty name, asdl_seq * body);
389arguments_ty arguments(asdl_seq * args, identifier vararg, identifier kwarg,
390 asdl_seq * defaults);
391keyword_ty keyword(identifier arg, expr_ty value);
392alias_ty alias(identifier name, identifier asname);
Neal Norwitz7b5a6042005-11-13 19:14:20 +0000393
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000394void free_mod(mod_ty);
395void free_stmt(stmt_ty);
396void free_expr(expr_ty);
397void free_expr_context(expr_context_ty);
398void free_slice(slice_ty);
399void free_boolop(boolop_ty);
400void free_operator(operator_ty);
401void free_unaryop(unaryop_ty);
402void free_cmpop(cmpop_ty);
403void free_comprehension(comprehension_ty);
404void free_excepthandler(excepthandler_ty);
405void free_arguments(arguments_ty);
406void free_keyword(keyword_ty);
407void free_alias(alias_ty);
Neal Norwitz7b5a6042005-11-13 19:14:20 +0000408