| 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 |
_Py_DECLARE_STR(empty, "") |
| 17 |
#if defined(Py_DEBUG) && defined(Py_GIL_DISABLED) |
| 18 |
#define _parser_runtime_state_INIT \ |
| 19 |
{ \ |
| 20 |
.mutex = {0}, \ |
| 21 |
.dummy_name = { \ |
| 22 |
.kind = Name_kind, \ |
| 23 |
.v.Name.id = &_Py_STR(empty), \ |
| 24 |
.v.Name.ctx = Load, \ |
| 25 |
.lineno = 1, \ |
| 26 |
.col_offset = 0, \ |
| 27 |
.end_lineno = 1, \ |
| 28 |
.end_col_offset = 0, \ |
| 29 |
}, \ |
| 30 |
} |
| 31 |
#else |
| 32 |
#define _parser_runtime_state_INIT \ |
| 33 |
{ \ |
| 34 |
.dummy_name = { \ |
| 35 |
.kind = Name_kind, \ |
| 36 |
.v.Name.id = &_Py_STR(empty), \ |
| 37 |
.v.Name.ctx = Load, \ |
| 38 |
.lineno = 1, \ |
| 39 |
.col_offset = 0, \ |
| 40 |
.end_lineno = 1, \ |
| 41 |
.end_col_offset = 0, \ |
| 42 |
}, \ |
| 43 |
} |
| 44 |
#endif |
| 45 |
|
| 46 |
extern struct _mod* _PyParser_ASTFromString( |
| 47 |
const char *str, |
| 48 |
PyObject* filename, |
| 49 |
int mode, |
| 50 |
PyCompilerFlags *flags, |
| 51 |
PyArena *arena); |
| 52 |
|
| 53 |
extern struct _mod* _PyParser_ASTFromFile( |
| 54 |
FILE *fp, |
| 55 |
PyObject *filename_ob, |
| 56 |
const char *enc, |
| 57 |
int mode, |
| 58 |
const char *ps1, |
| 59 |
const char *ps2, |
| 60 |
PyCompilerFlags *flags, |
| 61 |
int *errcode, |
| 62 |
PyArena *arena); |
| 63 |
extern struct _mod* _PyParser_InteractiveASTFromFile( |
| 64 |
FILE *fp, |
| 65 |
PyObject *filename_ob, |
| 66 |
const char *enc, |
| 67 |
int mode, |
| 68 |
const char *ps1, |
| 69 |
const char *ps2, |
| 70 |
PyCompilerFlags *flags, |
| 71 |
int *errcode, |
| 72 |
PyObject **interactive_src, |
| 73 |
PyArena *arena); |
| 74 |
|
| 75 |
#ifdef __cplusplus |
| 76 |
} |
| 77 |
#endif |
| 78 |
#endif /* !Py_INTERNAL_PARSER_H */ |