| #ifndef Py_INTERNAL_SYMTABLE_H |
| #define Py_INTERNAL_SYMTABLE_H |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
|
|
| #ifndef Py_BUILD_CORE |
| # error "this header requires Py_BUILD_CORE define" |
| #endif |
|
|
| struct _mod; |
|
|
| typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock, AnnotationBlock } |
| _Py_block_ty; |
|
|
| struct _symtable_entry; |
|
|
| struct symtable { |
| PyObject *st_filename; |
| |
| struct _symtable_entry *st_cur; |
| struct _symtable_entry *st_top; |
| PyObject *st_blocks; |
| |
| PyObject *st_stack; |
| PyObject *st_global; |
| int st_nblocks; |
| |
| |
| PyObject *st_private; |
| PyFutureFeatures *st_future; |
| |
| int recursion_depth; |
| int recursion_limit; |
| }; |
|
|
| typedef struct _symtable_entry { |
| PyObject_HEAD |
| PyObject *ste_id; |
| PyObject *ste_symbols; |
| PyObject *ste_name; |
| PyObject *ste_varnames; |
| PyObject *ste_children; |
| PyObject *ste_directives; |
| _Py_block_ty ste_type; |
| int ste_nested; |
| unsigned ste_free : 1; |
| unsigned ste_child_free : 1; |
| |
| unsigned ste_generator : 1; |
| unsigned ste_coroutine : 1; |
| unsigned ste_comprehension : 1; |
| unsigned ste_varargs : 1; |
| unsigned ste_varkeywords : 1; |
| unsigned ste_returns_value : 1; |
| |
| unsigned ste_needs_class_closure : 1; |
| |
| |
| unsigned ste_comp_iter_target : 1; |
| int ste_comp_iter_expr; |
| int ste_lineno; |
| int ste_col_offset; |
| int ste_end_lineno; |
| int ste_end_col_offset; |
| int ste_opt_lineno; |
| int ste_opt_col_offset; |
| struct symtable *ste_table; |
| } PySTEntryObject; |
|
|
| extern PyTypeObject PySTEntry_Type; |
|
|
| #define PySTEntry_Check(op) Py_IS_TYPE(op, &PySTEntry_Type) |
|
|
| extern int _PyST_GetScope(PySTEntryObject *, PyObject *); |
|
|
| extern struct symtable* _PySymtable_Build( |
| struct _mod *mod, |
| PyObject *filename, |
| PyFutureFeatures *future); |
| PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); |
|
|
| extern void _PySymtable_Free(struct symtable *); |
|
|
| |
|
|
| #define DEF_GLOBAL 1 |
| #define DEF_LOCAL 2 |
| #define DEF_PARAM 2<<1 |
| #define DEF_NONLOCAL 2<<2 |
| #define USE 2<<3 |
| #define DEF_FREE 2<<4 |
| #define DEF_FREE_CLASS 2<<5 |
| #define DEF_IMPORT 2<<6 |
| #define DEF_ANNOT 2<<7 |
| #define DEF_COMP_ITER 2<<8 |
|
|
| #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) |
|
|
| |
| |
| |
| |
| #define SCOPE_OFFSET 11 |
| #define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL) |
|
|
| #define LOCAL 1 |
| #define GLOBAL_EXPLICIT 2 |
| #define GLOBAL_IMPLICIT 3 |
| #define FREE 4 |
| #define CELL 5 |
|
|
| #define GENERATOR 1 |
| #define GENERATOR_EXPRESSION 2 |
|
|
| |
| extern struct symtable* _Py_SymtableStringObjectFlags( |
| const char *str, |
| PyObject *filename, |
| int start, |
| PyCompilerFlags *flags); |
|
|
| #ifdef __cplusplus |
| } |
| #endif |
| #endif |
|
|