@@ -29,6 +29,29 @@ typedef enum _comprehension_type {
2929 SetComprehension = 3 ,
3030 GeneratorExpression = 4 } _Py_comprehension_ty ;
3131
32+ /* source location information */
33+ typedef struct {
34+ int lineno ;
35+ int end_lineno ;
36+ int col_offset ;
37+ int end_col_offset ;
38+ } _Py_SourceLocation ;
39+
40+ #define SRC_LOCATION_FROM_AST (n ) \
41+ (_Py_SourceLocation){ \
42+ .lineno = (n)->lineno, \
43+ .end_lineno = (n)->end_lineno, \
44+ .col_offset = (n)->col_offset, \
45+ .end_col_offset = (n)->end_col_offset }
46+
47+ static const _Py_SourceLocation NO_LOCATION = {-1 , -1 , -1 , -1 };
48+
49+ /* __future__ information */
50+ typedef struct {
51+ int ff_features ; /* flags set by future statements */
52+ _Py_SourceLocation ff_location ; /* location of last future statement */
53+ } _PyFutureFeatures ;
54+
3255struct _symtable_entry ;
3356
3457struct symtable {
@@ -44,7 +67,7 @@ struct symtable {
4467 consistency with the corresponding
4568 compiler structure */
4669 PyObject * st_private ; /* name of current class or NULL */
47- PyFutureFeatures * st_future ; /* module's future features that affect
70+ _PyFutureFeatures * st_future ; /* module's future features that affect
4871 the symbol table */
4972 int recursion_depth ; /* current recursion depth */
5073 int recursion_limit ; /* recursion limit */
@@ -100,7 +123,7 @@ extern int _PyST_IsFunctionLike(PySTEntryObject *);
100123extern struct symtable * _PySymtable_Build (
101124 struct _mod * mod ,
102125 PyObject * filename ,
103- PyFutureFeatures * future );
126+ _PyFutureFeatures * future );
104127extern PySTEntryObject * _PySymtable_Lookup (struct symtable * , void * );
105128
106129extern void _PySymtable_Free (struct symtable * );
@@ -150,7 +173,7 @@ extern struct symtable* _Py_SymtableStringObjectFlags(
150173int _PyFuture_FromAST (
151174 struct _mod * mod ,
152175 PyObject * filename ,
153- PyFutureFeatures * futures );
176+ _PyFutureFeatures * futures );
154177
155178#ifdef __cplusplus
156179}
0 commit comments