Neal Norwitz | 897ff81 | 2005-12-11 21:18:22 +0000 | [diff] [blame] | 1 | /* File automatically generated by Parser/asdl_c.py */ |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 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 | |
Neal Norwitz | 7b5a604 | 2005-11-13 19:14:20 +0000 | [diff] [blame] | 37 | |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 38 | struct _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 | |
| 61 | struct _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 | |
| 176 | struct _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 | |
| 280 | struct _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 | |
| 301 | struct _comprehension { |
| 302 | expr_ty target; |
| 303 | expr_ty iter; |
| 304 | asdl_seq *ifs; |
| 305 | }; |
| 306 | |
| 307 | struct _excepthandler { |
| 308 | expr_ty type; |
| 309 | expr_ty name; |
| 310 | asdl_seq *body; |
| 311 | }; |
| 312 | |
| 313 | struct _arguments { |
| 314 | asdl_seq *args; |
| 315 | identifier vararg; |
| 316 | identifier kwarg; |
| 317 | asdl_seq *defaults; |
| 318 | }; |
| 319 | |
| 320 | struct _keyword { |
| 321 | identifier arg; |
| 322 | expr_ty value; |
| 323 | }; |
| 324 | |
| 325 | struct _alias { |
| 326 | identifier name; |
| 327 | identifier asname; |
| 328 | }; |
| 329 | |
Neal Norwitz | 7b5a604 | 2005-11-13 19:14:20 +0000 | [diff] [blame] | 330 | |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 331 | mod_ty Module(asdl_seq * body, PyArena *arena); |
| 332 | mod_ty Interactive(asdl_seq * body, PyArena *arena); |
| 333 | mod_ty Expression(expr_ty body, PyArena *arena); |
| 334 | mod_ty Suite(asdl_seq * body, PyArena *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 335 | stmt_ty FunctionDef(identifier name, arguments_ty args, asdl_seq * body, |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 336 | asdl_seq * decorators, int lineno, PyArena *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 337 | stmt_ty ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 338 | lineno, PyArena *arena); |
| 339 | stmt_ty Return(expr_ty value, int lineno, PyArena *arena); |
| 340 | stmt_ty Delete(asdl_seq * targets, int lineno, PyArena *arena); |
| 341 | stmt_ty Assign(asdl_seq * targets, expr_ty value, int lineno, PyArena *arena); |
| 342 | stmt_ty AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, |
| 343 | PyArena *arena); |
| 344 | stmt_ty Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, PyArena |
| 345 | *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 346 | stmt_ty For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 347 | int lineno, PyArena *arena); |
| 348 | stmt_ty While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, |
| 349 | PyArena *arena); |
| 350 | stmt_ty If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, |
| 351 | PyArena *arena); |
| 352 | stmt_ty Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, PyArena |
| 353 | *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 354 | stmt_ty TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 355 | lineno, PyArena *arena); |
| 356 | stmt_ty TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, PyArena |
| 357 | *arena); |
| 358 | stmt_ty Assert(expr_ty test, expr_ty msg, int lineno, PyArena *arena); |
| 359 | stmt_ty Import(asdl_seq * names, int lineno, PyArena *arena); |
| 360 | stmt_ty ImportFrom(identifier module, asdl_seq * names, int lineno, PyArena |
| 361 | *arena); |
| 362 | stmt_ty Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, PyArena |
| 363 | *arena); |
| 364 | stmt_ty Global(asdl_seq * names, int lineno, PyArena *arena); |
| 365 | stmt_ty Expr(expr_ty value, int lineno, PyArena *arena); |
| 366 | stmt_ty Pass(int lineno, PyArena *arena); |
| 367 | stmt_ty Break(int lineno, PyArena *arena); |
| 368 | stmt_ty Continue(int lineno, PyArena *arena); |
| 369 | expr_ty BoolOp(boolop_ty op, asdl_seq * values, int lineno, PyArena *arena); |
| 370 | expr_ty BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, PyArena |
| 371 | *arena); |
| 372 | expr_ty UnaryOp(unaryop_ty op, expr_ty operand, int lineno, PyArena *arena); |
| 373 | expr_ty Lambda(arguments_ty args, expr_ty body, int lineno, PyArena *arena); |
| 374 | expr_ty Dict(asdl_seq * keys, asdl_seq * values, int lineno, PyArena *arena); |
| 375 | expr_ty ListComp(expr_ty elt, asdl_seq * generators, int lineno, PyArena |
| 376 | *arena); |
| 377 | expr_ty GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, PyArena |
| 378 | *arena); |
| 379 | expr_ty Yield(expr_ty value, int lineno, PyArena *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 380 | expr_ty Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators, int |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 381 | lineno, PyArena *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 382 | expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 383 | starargs, expr_ty kwargs, int lineno, PyArena *arena); |
| 384 | expr_ty Repr(expr_ty value, int lineno, PyArena *arena); |
| 385 | expr_ty Num(object n, int lineno, PyArena *arena); |
| 386 | expr_ty Str(string s, int lineno, PyArena *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 387 | expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 388 | lineno, PyArena *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 389 | expr_ty Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 390 | lineno, PyArena *arena); |
| 391 | expr_ty Name(identifier id, expr_context_ty ctx, int lineno, PyArena *arena); |
| 392 | expr_ty List(asdl_seq * elts, expr_context_ty ctx, int lineno, PyArena *arena); |
| 393 | expr_ty Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, PyArena *arena); |
| 394 | slice_ty Ellipsis(PyArena *arena); |
| 395 | slice_ty Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena); |
| 396 | slice_ty ExtSlice(asdl_seq * dims, PyArena *arena); |
| 397 | slice_ty Index(expr_ty value, PyArena *arena); |
| 398 | comprehension_ty comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, |
| 399 | PyArena *arena); |
| 400 | excepthandler_ty excepthandler(expr_ty type, expr_ty name, asdl_seq * body, |
| 401 | PyArena *arena); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 402 | arguments_ty arguments(asdl_seq * args, identifier vararg, identifier kwarg, |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 403 | asdl_seq * defaults, PyArena *arena); |
| 404 | keyword_ty keyword(identifier arg, expr_ty value, PyArena *arena); |
| 405 | alias_ty alias(identifier name, identifier asname, PyArena *arena); |
Neal Norwitz | 7b5a604 | 2005-11-13 19:14:20 +0000 | [diff] [blame] | 406 | |