Debian Codegraph @

Include/internal/pycore_parser.h

raw
1 #ifndef Py_INTERNAL_PARSER_H
2 #define Py_INTERNAL_PARSER_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6
7 #ifndef Py_BUILD_CORE
8 # error "this header requires Py_BUILD_CORE define"
9 #endif
10
11
12 #include "pycore_ast.h" // struct _expr
13 #include "pycore_global_strings.h" // _Py_DECLARE_STR()
14 #include "pycore_pyarena.h" // PyArena
15
16
17 #ifdef Py_DEBUG
18 #define _PYPEGEN_NSTATISTICS 2000
19 #endif
20
21 struct _parser_runtime_state {
22 #ifdef Py_DEBUG
23 long memo_statistics[_PYPEGEN_NSTATISTICS];
24 #ifdef Py_GIL_DISABLED
25 PyMutex mutex;
26 #endif
27 #else
28 int _not_used;
29 #endif
30 struct _expr dummy_name;
31 };
32
33 _Py_DECLARE_STR(empty, "")
34 #if defined(Py_DEBUG) && defined(Py_GIL_DISABLED)
35 #define _parser_runtime_state_INIT \
36 { \
37 .mutex = {0}, \
38 .dummy_name = { \
39 .kind = Name_kind, \
40 .v.Name.id = &_Py_STR(empty), \
41 .v.Name.ctx = Load, \
42 .lineno = 1, \
43 .col_offset = 0, \
44 .end_lineno = 1, \
45 .end_col_offset = 0, \
46 }, \
47 }
48 #else
49 #define _parser_runtime_state_INIT \
50 { \
51 .dummy_name = { \
52 .kind = Name_kind, \
53 .v.Name.id = &_Py_STR(empty), \
54 .v.Name.ctx = Load, \
55 .lineno = 1, \
56 .col_offset = 0, \
57 .end_lineno = 1, \
58 .end_col_offset = 0, \
59 }, \
60 }
61 #endif
62
63 extern struct _mod* _PyParser_ASTFromString(
64 const char *str,
65 PyObject* filename,
66 int mode,
67 PyCompilerFlags *flags,
68 PyArena *arena);
69
70 extern struct _mod* _PyParser_ASTFromFile(
71 FILE *fp,
72 PyObject *filename_ob,
73 const char *enc,
74 int mode,
75 const char *ps1,
76 const char *ps2,
77 PyCompilerFlags *flags,
78 int *errcode,
79 PyArena *arena);
80 extern struct _mod* _PyParser_InteractiveASTFromFile(
81 FILE *fp,
82 PyObject *filename_ob,
83 const char *enc,
84 int mode,
85 const char *ps1,
86 const char *ps2,
87 PyCompilerFlags *flags,
88 int *errcode,
89 PyObject **interactive_src,
90 PyArena *arena);
91
92 #ifdef __cplusplus
93 }
94 #endif
95 #endif /* !Py_INTERNAL_PARSER_H */