Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

node.h 1.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  1. /* Parse tree node interface */
  2. #ifndef Py_NODE_H
  3. #define Py_NODE_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct _node {
  8. short n_type;
  9. char *n_str;
  10. int n_lineno;
  11. int n_col_offset;
  12. int n_nchildren;
  13. struct _node *n_child;
  14. } node;
  15. PyAPI_FUNC(node *) PyNode_New(int type);
  16. PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
  17. char *str, int lineno, int col_offset);
  18. PyAPI_FUNC(void) PyNode_Free(node *n);
  19. #ifndef Py_LIMITED_API
  20. PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
  21. #endif
  22. /* Node access functions */
  23. #define NCH(n) ((n)->n_nchildren)
  24. #define CHILD(n, i) (&(n)->n_child[i])
  25. #define RCHILD(n, i) (CHILD(n, NCH(n) + i))
  26. #define TYPE(n) ((n)->n_type)
  27. #define STR(n) ((n)->n_str)
  28. #define LINENO(n) ((n)->n_lineno)
  29. /* Assert that the type of a node is what we expect */
  30. #define REQ(n, type) assert(TYPE(n) == (type))
  31. PyAPI_FUNC(void) PyNode_ListTree(node *);
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif /* !Py_NODE_H */
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...