File indexing completed on 2025-01-18 10:06:46
0001 #ifndef Py_INTERNAL_PARSER_H
0002 #define Py_INTERNAL_PARSER_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006
0007 #ifndef Py_BUILD_CORE
0008 # error "this header requires Py_BUILD_CORE define"
0009 #endif
0010
0011
0012 #include "pycore_ast.h" // struct _expr
0013 #include "pycore_global_strings.h" // _Py_DECLARE_STR()
0014 #include "pycore_pyarena.h" // PyArena
0015
0016
0017 #ifdef Py_DEBUG
0018 #define _PYPEGEN_NSTATISTICS 2000
0019 #endif
0020
0021 struct _parser_runtime_state {
0022 #ifdef Py_DEBUG
0023 long memo_statistics[_PYPEGEN_NSTATISTICS];
0024 #else
0025 int _not_used;
0026 #endif
0027 struct _expr dummy_name;
0028 };
0029
0030 _Py_DECLARE_STR(empty, "")
0031 #define _parser_runtime_state_INIT \
0032 { \
0033 .dummy_name = { \
0034 .kind = Name_kind, \
0035 .v.Name.id = &_Py_STR(empty), \
0036 .v.Name.ctx = Load, \
0037 .lineno = 1, \
0038 .col_offset = 0, \
0039 .end_lineno = 1, \
0040 .end_col_offset = 0, \
0041 }, \
0042 }
0043
0044 extern struct _mod* _PyParser_ASTFromString(
0045 const char *str,
0046 PyObject* filename,
0047 int mode,
0048 PyCompilerFlags *flags,
0049 PyArena *arena);
0050
0051 extern struct _mod* _PyParser_ASTFromFile(
0052 FILE *fp,
0053 PyObject *filename_ob,
0054 const char *enc,
0055 int mode,
0056 const char *ps1,
0057 const char *ps2,
0058 PyCompilerFlags *flags,
0059 int *errcode,
0060 PyArena *arena);
0061
0062
0063 #ifdef __cplusplus
0064 }
0065 #endif
0066 #endif