bpo-40939: Rename PyPegen* functions to PyParser* (GH-21016)
Rename PyPegen* functions to PyParser*, so that we can remove the
old set of PyParser* functions that were using the old parser.
diff --git a/Include/Python.h b/Include/Python.h
index dcd0a57..57f71d4 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -141,6 +141,7 @@
#include "modsupport.h"
#include "compile.h"
#include "pythonrun.h"
+#include "parser_interface.h"
#include "pylifecycle.h"
#include "ceval.h"
#include "sysmodule.h"
diff --git a/Include/internal/pegen_interface.h b/Include/internal/pegen_interface.h
deleted file mode 100644
index ee4c77e..0000000
--- a/Include/internal/pegen_interface.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef Py_PEGENINTERFACE
-#define Py_PEGENINTERFACE
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef Py_BUILD_CORE
-# error "this header requires Py_BUILD_CORE define"
-#endif
-
-#include "Python.h"
-#include "Python-ast.h"
-
-PyAPI_FUNC(mod_ty) PyPegen_ASTFromString(
- const char *str,
- const char *filename,
- int mode,
- PyCompilerFlags *flags,
- PyArena *arena);
-PyAPI_FUNC(mod_ty) PyPegen_ASTFromStringObject(
- const char *str,
- PyObject* filename,
- int mode,
- PyCompilerFlags *flags,
- PyArena *arena);
-PyAPI_FUNC(mod_ty) PyPegen_ASTFromFileObject(
- FILE *fp,
- PyObject *filename_ob,
- int mode,
- const char *enc,
- const char *ps1,
- const char *ps2,
- PyCompilerFlags *flags,
- int *errcode,
- PyArena *arena);
-PyAPI_FUNC(mod_ty) PyPegen_ASTFromFilename(
- const char *filename,
- int mode,
- PyCompilerFlags *flags,
- PyArena *arena);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_PEGENINTERFACE*/
diff --git a/Include/parser_interface.h b/Include/parser_interface.h
new file mode 100644
index 0000000..1c6576d
--- /dev/null
+++ b/Include/parser_interface.h
@@ -0,0 +1,52 @@
+#ifndef Py_PEGENINTERFACE
+#define Py_PEGENINTERFACE
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "Python.h"
+
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(
+ const char *str,
+ const char *filename,
+ int mode,
+ PyCompilerFlags *flags,
+ PyArena *arena);
+PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject(
+ const char *str,
+ PyObject* filename,
+ int mode,
+ PyCompilerFlags *flags,
+ PyArena *arena);
+PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
+ FILE *fp,
+ const char *filename,
+ const char* enc,
+ int mode,
+ const char *ps1,
+ const char *ps2,
+ PyCompilerFlags *flags,
+ int *errcode,
+ PyArena *arena);
+PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
+ FILE *fp,
+ PyObject *filename_ob,
+ const char *enc,
+ int mode,
+ const char *ps1,
+ const char *ps2,
+ PyCompilerFlags *flags,
+ int *errcode,
+ PyArena *arena);
+PyAPI_FUNC(struct _mod *) PyParser_ASTFromFilename(
+ const char *filename,
+ int mode,
+ PyCompilerFlags *flags,
+ PyArena *arena);
+#endif /* !Py_LIMITED_API */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_PEGENINTERFACE */
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 46091e0..d43734b 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -32,57 +32,7 @@
const char *filename, /* decoded from the filesystem encoding */
PyCompilerFlags *flags);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(
- const char *s,
- const char *filename, /* decoded from the filesystem encoding */
- int start,
- PyCompilerFlags *flags,
- PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject(
- const char *s,
- PyObject *filename,
- int start,
- PyCompilerFlags *flags,
- PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
- FILE *fp,
- const char *filename, /* decoded from the filesystem encoding */
- const char* enc,
- int start,
- const char *ps1,
- const char *ps2,
- PyCompilerFlags *flags,
- int *errcode,
- PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
- FILE *fp,
- PyObject *filename,
- const char* enc,
- int start,
- const char *ps1,
- const char *ps2,
- PyCompilerFlags *flags,
- int *errcode,
- PyArena *arena);
-#endif
-#ifndef PyParser_SimpleParseString
-#define PyParser_SimpleParseString(S, B) \
- PyParser_SimpleParseStringFlags(S, B, 0)
-#define PyParser_SimpleParseFile(FP, S, B) \
- PyParser_SimpleParseFileFlags(FP, S, B, 0)
-#endif
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
- int);
-#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
- const char *,
- int, int);
-#endif
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
- int, int);
-
-#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
PyObject *, PyCompilerFlags *);