/* File automatically generated by Parser/asdl_c.py. */
+#ifndef Py_PYTHON_AST_H
+#define Py_PYTHON_AST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "asdl.h"
+#undef Yield /* undefine macro conflicting with winbase.h */
+
typedef struct _mod *mod_ty;
typedef struct _stmt *stmt_ty;
PyObject* PyAST_mod2obj(mod_ty t);
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
int PyAST_Check(PyObject* obj);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_PYTHON_AST_H */
extern "C" {
#endif
+#include "Python-ast.h" /* mod_ty */
+#include "node.h" /* node */
+
PyAPI_FUNC(int) PyAST_Validate(mod_ty);
PyAPI_FUNC(mod_ty) PyAST_FromNode(
const node *n,
-
/* Parser-tokenizer link interface */
+
#ifndef Py_LIMITED_API
#ifndef Py_PARSETOK_H
#define Py_PARSETOK_H
extern "C" {
#endif
+#include "grammar.h" /* grammar */
+#include "node.h" /* node */
+
typedef struct {
int error;
#ifndef PGEN
#ifndef Py_LIMITED_API
#ifndef Py_SYMTABLE_H
#define Py_SYMTABLE_H
-
#ifdef __cplusplus
extern "C" {
#endif
+#include "Python-ast.h" /* mod_ty */
+
/* XXX(ncoghlan): This is a weird mix of public names and interpreter internal
* names.
*/
}
#endif
#endif /* !Py_SYMTABLE_H */
-#endif /* Py_LIMITED_API */
+#endif /* !Py_LIMITED_API */
#include "Python.h" /* general Python API */
#include "Python-ast.h" /* mod_ty */
+#include "ast.h"
#include "graminit.h" /* symbols defined in the grammar */
#include "node.h" /* internal parser structure */
#include "errcode.h" /* error codes for PyNode_*() */
#include "token.h" /* token definitions */
+ /* ISTERMINAL() / ISNONTERMINAL() */
#include "grammar.h"
#include "parsetok.h"
- /* ISTERMINAL() / ISNONTERMINAL() */
-#undef Yield
-#include "ast.h"
extern grammar _PyParser_Grammar; /* From graminit.c */
if H_FILE:
with open(H_FILE, "w") as f:
f.write(auto_gen_msg)
- f.write('#include "asdl.h"\n\n')
+ f.write('#ifndef Py_PYTHON_AST_H\n')
+ f.write('#define Py_PYTHON_AST_H\n')
+ f.write('#ifdef __cplusplus\n')
+ f.write('extern "C" {\n')
+ f.write('#endif\n')
+ f.write('\n')
+ f.write('#include "asdl.h"\n')
+ f.write('\n')
+ f.write('#undef Yield /* undefine macro conflicting with winbase.h */\n')
+ f.write('\n')
c = ChainOfVisitors(TypeDefVisitor(f),
StructVisitor(f),
PrototypeVisitor(f),
f.write("PyObject* PyAST_mod2obj(mod_ty t);\n")
f.write("mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);\n")
f.write("int PyAST_Check(PyObject* obj);\n")
+ f.write('\n')
+ f.write('#ifdef __cplusplus\n')
+ f.write('}\n')
+ f.write('#endif\n')
+ f.write('#endif /* !Py_PYTHON_AST_H */\n')
if C_FILE:
with open(C_FILE, "w") as f:
/* AST Optimizer */
#include "Python.h"
#include "Python-ast.h"
-#include "node.h"
#include "ast.h"
/* Built-in functions */
#include "Python.h"
-#include "Python-ast.h"
-#include "pycore_state.h"
-
-#include "node.h"
-#include "code.h"
-
-#include "asdl.h"
-#include "ast.h"
-
#include <ctype.h>
+#include "ast.h"
+#include "pycore_state.h"
_Py_IDENTIFIER(__builtins__);
_Py_IDENTIFIER(__dict__);
#include "Python.h"
#include "Python-ast.h"
-#include "node.h"
#include "ast.h"
#include "code.h"
#include "symtable.h"
#include "Python.h"
#include "Python-ast.h"
-#undef Yield /* undefine macro conflicting with winbase.h */
#include "pycore_hash.h"
#include "pycore_lifecycle.h"
#include "pycore_mem.h"
#include "Python.h"
#include "Python-ast.h"
-#undef Yield /* undefine macro conflicting with winbase.h */
#include "pycore_context.h"
#include "pycore_hamt.h"
#include "pycore_lifecycle.h"
#include "Python.h"
#include "Python-ast.h"
-#undef Yield /* undefine macro conflicting with winbase.h */
#include "pycore_state.h"
#include "grammar.h"
#include "node.h"
#include "Python.h"
#include "pycore_state.h"
-#ifdef Yield
-#undef Yield /* undefine conflicting macro from winbase.h */
-#endif
-#include "Python-ast.h"
-#include "code.h"
#include "symtable.h"
#include "structmember.h"