diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-02-27 19:07:02 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-02-27 19:07:02 (GMT) |
commit | 4db62b1e14ed909d4bd574633a11c45455c76beb (patch) | |
tree | 3bf20f1bab90d74a8b189f5cb31da0d6fa320a2f /Include | |
parent | ed5e8234d76881fee036a3d2e642c6a7434c6eec (diff) | |
download | cpython-4db62b1e14ed909d4bd574633a11c45455c76beb.zip cpython-4db62b1e14ed909d4bd574633a11c45455c76beb.tar.gz cpython-4db62b1e14ed909d4bd574633a11c45455c76beb.tar.bz2 |
Improved __future__ parser; still more to do
Makefile.pre.in: add target future.o
Include/compile.h: define PyFutureFeaters and PyNode_Future()
add c_future slot to struct compiling
Include/symtable.h: add st_future slot to struct symtable
Python/future.c: implementation of PyNode_Future()
Python/compile.c: use PyNode_Future() for nested_scopes support
Python/symtable.c: include compile.h to pick up PyFutureFeatures decl
Diffstat (limited to 'Include')
-rw-r--r-- | Include/compile.h | 16 | ||||
-rw-r--r-- | Include/symtable.h | 1 |
2 files changed, 14 insertions, 3 deletions
diff --git a/Include/compile.h b/Include/compile.h index 5d65c5d..ecc1575 100644 --- a/Include/compile.h +++ b/Include/compile.h @@ -7,9 +7,6 @@ extern "C" { #endif -#define NESTED_SCOPES_DEFAULT 0 -#define FUTURE_NESTED_SCOPES "nested_scopes" - /* Bytecode object */ typedef struct { PyObject_HEAD @@ -51,6 +48,19 @@ DL_IMPORT(PyCodeObject *) PyCode_New( /* same as struct above */ DL_IMPORT(int) PyCode_Addr2Line(PyCodeObject *, int); +/* Future feature support */ + +typedef struct { + int ff_last_lineno; + int ff_n_simple_stmt; + int ff_nested_scopes; +} PyFutureFeatures; + +DL_IMPORT(PyFutureFeatures *) PyNode_Future(struct _node *, char *); + +#define NESTED_SCOPES_DEFAULT 0 +#define FUTURE_NESTED_SCOPES "nested_scopes" + /* for internal use only */ #define _PyCode_GETCODEPTR(co, pp) \ ((*(co)->co_code->ob_type->tp_as_buffer->bf_getreadbuffer) \ diff --git a/Include/symtable.h b/Include/symtable.h index eb0be1a..7d1e0c3 100644 --- a/Include/symtable.h +++ b/Include/symtable.h @@ -30,6 +30,7 @@ struct symtable { int st_errors; /* number of errors */ char *st_private; /* name of current class or NULL */ int st_tmpname; /* temporary name counter */ + PyFutureFeatures *st_future; /* module's future features */ }; typedef struct _symtable_entry { |