Last change
on this file was 392, checked in by dmik, 11 years ago |
python: Fix build break of parser module on OS/2.
|
-
Property svn:eol-style
set to
native
|
File size:
968 bytes
|
Rev | Line | |
---|
[2] | 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 | } node;
|
---|
| 18 |
|
---|
| 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);
|
---|
[391] | 23 | #ifndef Py_LIMITED_API
|
---|
[392] | 24 | PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
|
---|
[391] | 25 | #endif
|
---|
[2] | 26 |
|
---|
| 27 | /* Node access functions */
|
---|
| 28 | #define NCH(n) ((n)->n_nchildren)
|
---|
| 29 |
|
---|
| 30 | #define CHILD(n, i) (&(n)->n_child[i])
|
---|
| 31 | #define RCHILD(n, i) (CHILD(n, NCH(n) + i))
|
---|
| 32 | #define TYPE(n) ((n)->n_type)
|
---|
| 33 | #define STR(n) ((n)->n_str)
|
---|
| 34 |
|
---|
| 35 | /* Assert that the type of a node is what we expect */
|
---|
| 36 | #define REQ(n, type) assert(TYPE(n) == (type))
|
---|
| 37 |
|
---|
| 38 | PyAPI_FUNC(void) PyNode_ListTree(node *);
|
---|
| 39 |
|
---|
| 40 | #ifdef __cplusplus
|
---|
| 41 | }
|
---|
| 42 | #endif
|
---|
| 43 | #endif /* !Py_NODE_H */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.