summaryrefslogtreecommitdiffstats
path: root/Include/cpython/compile.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/cpython/compile.h')
-rw-r--r--Include/cpython/compile.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/Include/cpython/compile.h b/Include/cpython/compile.h
index 518a376..f5a62a8 100644
--- a/Include/cpython/compile.h
+++ b/Include/cpython/compile.h
@@ -31,11 +31,26 @@ typedef struct {
#define _PyCompilerFlags_INIT \
(PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION}
+/* source location information */
+typedef struct {
+ int lineno;
+ int end_lineno;
+ int col_offset;
+ int end_col_offset;
+} _PyCompilerSrcLocation;
+
+#define SRC_LOCATION_FROM_AST(n) \
+ (_PyCompilerSrcLocation){ \
+ .lineno = (n)->lineno, \
+ .end_lineno = (n)->end_lineno, \
+ .col_offset = (n)->col_offset, \
+ .end_col_offset = (n)->end_col_offset }
+
/* Future feature support */
typedef struct {
- int ff_features; /* flags set by future statements */
- int ff_lineno; /* line number of last future statement */
+ int ff_features; /* flags set by future statements */
+ _PyCompilerSrcLocation ff_location; /* location of last future statement */
} PyFutureFeatures;
#define FUTURE_NESTED_SCOPES "nested_scopes"