| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 * This file includes functions to transform a concrete syntax tree (CST) to | 2 * This file includes functions to transform a concrete syntax tree (CST) to |
| 3 * an abstract syntax tree (AST). The main function is PyAST_FromNode(). | 3 * an abstract syntax tree (AST). The main function is PyAST_FromNode(). |
| 4 * | 4 * |
| 5 */ | 5 */ |
| 6 #include "Python.h" | 6 #include "Python.h" |
| 7 #include "Python-ast.h" | 7 #include "Python-ast.h" |
| 8 #include "grammar.h" | 8 #include "grammar.h" |
| 9 #include "node.h" | 9 #include "node.h" |
| 10 #include "pyarena.h" | 10 #include "pyarena.h" |
| (...skipping 3024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3035 } | 3035 } |
| 3036 | 3036 |
| 3037 /* with_stmt: 'with' with_item (',' with_item)* ':' suite */ | 3037 /* with_stmt: 'with' with_item (',' with_item)* ':' suite */ |
| 3038 static stmt_ty | 3038 static stmt_ty |
| 3039 ast_for_with_stmt(struct compiling *c, const node *n) | 3039 ast_for_with_stmt(struct compiling *c, const node *n) |
| 3040 { | 3040 { |
| 3041 int i; | 3041 int i; |
| 3042 stmt_ty ret; | 3042 stmt_ty ret; |
| 3043 asdl_seq *inner; | 3043 asdl_seq *inner; |
| 3044 | 3044 |
| 3045 assert(TYPE(n) == with_stmt); | 3045 REQ(n, with_stmt); |
|
Benjamin
2009/05/02 18:22:06
REQ() is better here.
Georg
2009/05/02 18:48:00
It was already there, but Done.
| |
| 3046 | 3046 |
| 3047 /* process the with items inside-out */ | 3047 /* process the with items inside-out */ |
| 3048 i = NCH(n) - 1; | 3048 i = NCH(n) - 1; |
| 3049 /* the suite of the innermost with item is the suite of the with stmt */ | 3049 /* the suite of the innermost with item is the suite of the with stmt */ |
| 3050 inner = ast_for_suite(c, CHILD(n, i)); | 3050 inner = ast_for_suite(c, CHILD(n, i)); |
| 3051 if (!inner) | 3051 if (!inner) |
| 3052 return NULL; | 3052 return NULL; |
| 3053 | 3053 |
| 3054 for (;;) { | 3054 for (;;) { |
| 3055 i -= 2; | 3055 i -= 2; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3442 } | 3442 } |
| 3443 #endif | 3443 #endif |
| 3444 } | 3444 } |
| 3445 } | 3445 } |
| 3446 return v; | 3446 return v; |
| 3447 | 3447 |
| 3448 onError: | 3448 onError: |
| 3449 Py_XDECREF(v); | 3449 Py_XDECREF(v); |
| 3450 return NULL; | 3450 return NULL; |
| 3451 } | 3451 } |
| LEFT | RIGHT |