Mercurial > repos > rliterman > csp2
comparison 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 |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 | |
2 /* Parse tree node interface */ | |
3 | |
4 #ifndef Py_NODE_H | |
5 #define Py_NODE_H | |
6 #ifdef __cplusplus | |
7 extern "C" { | |
8 #endif | |
9 | |
10 typedef struct _node { | |
11 short n_type; | |
12 char *n_str; | |
13 int n_lineno; | |
14 int n_col_offset; | |
15 int n_nchildren; | |
16 struct _node *n_child; | |
17 int n_end_lineno; | |
18 int n_end_col_offset; | |
19 } node; | |
20 | |
21 PyAPI_FUNC(node *) PyNode_New(int type); | |
22 PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, | |
23 char *str, int lineno, int col_offset, | |
24 int end_lineno, int end_col_offset); | |
25 PyAPI_FUNC(void) PyNode_Free(node *n); | |
26 #ifndef Py_LIMITED_API | |
27 PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n); | |
28 #endif | |
29 | |
30 /* Node access functions */ | |
31 #define NCH(n) ((n)->n_nchildren) | |
32 | |
33 #define CHILD(n, i) (&(n)->n_child[i]) | |
34 #define RCHILD(n, i) (CHILD(n, NCH(n) + i)) | |
35 #define TYPE(n) ((n)->n_type) | |
36 #define STR(n) ((n)->n_str) | |
37 #define LINENO(n) ((n)->n_lineno) | |
38 | |
39 /* Assert that the type of a node is what we expect */ | |
40 #define REQ(n, type) assert(TYPE(n) == (type)) | |
41 | |
42 PyAPI_FUNC(void) PyNode_ListTree(node *); | |
43 void _PyNode_FinalizeEndPos(node *n); // helper also used in parsetok.c | |
44 | |
45 #ifdef __cplusplus | |
46 } | |
47 #endif | |
48 #endif /* !Py_NODE_H */ |