annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/node.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1
jpayne@69 2 /* Parse tree node interface */
jpayne@69 3
jpayne@69 4 #ifndef Py_NODE_H
jpayne@69 5 #define Py_NODE_H
jpayne@69 6 #ifdef __cplusplus
jpayne@69 7 extern "C" {
jpayne@69 8 #endif
jpayne@69 9
jpayne@69 10 typedef struct _node {
jpayne@69 11 short n_type;
jpayne@69 12 char *n_str;
jpayne@69 13 int n_lineno;
jpayne@69 14 int n_col_offset;
jpayne@69 15 int n_nchildren;
jpayne@69 16 struct _node *n_child;
jpayne@69 17 int n_end_lineno;
jpayne@69 18 int n_end_col_offset;
jpayne@69 19 } node;
jpayne@69 20
jpayne@69 21 PyAPI_FUNC(node *) PyNode_New(int type);
jpayne@69 22 PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
jpayne@69 23 char *str, int lineno, int col_offset,
jpayne@69 24 int end_lineno, int end_col_offset);
jpayne@69 25 PyAPI_FUNC(void) PyNode_Free(node *n);
jpayne@69 26 #ifndef Py_LIMITED_API
jpayne@69 27 PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
jpayne@69 28 #endif
jpayne@69 29
jpayne@69 30 /* Node access functions */
jpayne@69 31 #define NCH(n) ((n)->n_nchildren)
jpayne@69 32
jpayne@69 33 #define CHILD(n, i) (&(n)->n_child[i])
jpayne@69 34 #define RCHILD(n, i) (CHILD(n, NCH(n) + i))
jpayne@69 35 #define TYPE(n) ((n)->n_type)
jpayne@69 36 #define STR(n) ((n)->n_str)
jpayne@69 37 #define LINENO(n) ((n)->n_lineno)
jpayne@69 38
jpayne@69 39 /* Assert that the type of a node is what we expect */
jpayne@69 40 #define REQ(n, type) assert(TYPE(n) == (type))
jpayne@69 41
jpayne@69 42 PyAPI_FUNC(void) PyNode_ListTree(node *);
jpayne@69 43 void _PyNode_FinalizeEndPos(node *n); // helper also used in parsetok.c
jpayne@69 44
jpayne@69 45 #ifdef __cplusplus
jpayne@69 46 }
jpayne@69 47 #endif
jpayne@69 48 #endif /* !Py_NODE_H */