2 /* Parse tree node interface */
10 typedef struct _node
{
16 struct _node
*n_child
;
19 PyAPI_FUNC(node
*) PyNode_New(int type
);
20 PyAPI_FUNC(int) PyNode_AddChild(node
*n
, int type
,
21 char *str
, int lineno
, int col_offset
);
22 PyAPI_FUNC(void) PyNode_Free(node
*n
);
24 /* Node access functions */
25 #define NCH(n) ((n)->n_nchildren)
27 #define CHILD(n, i) (&(n)->n_child[i])
28 #define RCHILD(n, i) (CHILD(n, NCH(n) + i))
29 #define TYPE(n) ((n)->n_type)
30 #define STR(n) ((n)->n_str)
32 /* Assert that the type of a node is what we expect */
33 #define REQ(n, type) assert(TYPE(n) == (type))
35 PyAPI_FUNC(void) PyNode_ListTree(node
*);
40 #endif /* !Py_NODE_H */