Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 1 | |
Fred Drake | ea9cb5a | 2000-07-09 00:20:36 +0000 | [diff] [blame] | 2 | #ifndef Py_COMPILE_H |
| 3 | #define Py_COMPILE_H |
Thomas Wouters | ca82a8b | 2006-02-28 23:09:08 +0000 | [diff] [blame] | 4 | |
| 5 | #include "code.h" |
| 6 | |
Fred Drake | ea9cb5a | 2000-07-09 00:20:36 +0000 | [diff] [blame] | 7 | #ifdef __cplusplus |
| 8 | extern "C" { |
| 9 | #endif |
| 10 | |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 11 | /* Public interface */ |
Guido van Rossum | e543a94 | 1991-04-03 19:00:55 +0000 | [diff] [blame] | 12 | struct _node; /* Declare the existence of this type */ |
Martin v. Löwis | 95292d6 | 2002-12-11 14:04:59 +0000 | [diff] [blame] | 13 | PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 14 | |
Jeremy Hylton | 4db62b1 | 2001-02-27 19:07:02 +0000 | [diff] [blame] | 15 | /* Future feature support */ |
| 16 | |
| 17 | typedef struct { |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 18 | int ff_features; /* flags set by future statements */ |
| 19 | int ff_lineno; /* line number of last future statement */ |
Jeremy Hylton | 4db62b1 | 2001-02-27 19:07:02 +0000 | [diff] [blame] | 20 | } PyFutureFeatures; |
| 21 | |
Jeremy Hylton | 4db62b1 | 2001-02-27 19:07:02 +0000 | [diff] [blame] | 22 | #define FUTURE_NESTED_SCOPES "nested_scopes" |
Guido van Rossum | b09f7ed | 2001-07-15 21:08:29 +0000 | [diff] [blame] | 23 | #define FUTURE_GENERATORS "generators" |
Guido van Rossum | 4668b00 | 2001-08-08 05:00:18 +0000 | [diff] [blame] | 24 | #define FUTURE_DIVISION "division" |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 25 | #define FUTURE_ABSOLUTE_IMPORT "absolute_import" |
Thomas Wouters | 34aa7ba | 2006-02-28 19:02:24 +0000 | [diff] [blame] | 26 | #define FUTURE_WITH_STATEMENT "with_statement" |
Eric Smith | 8782408 | 2008-03-20 23:02:08 +0000 | [diff] [blame] | 27 | #define FUTURE_PRINT_FUNCTION "print_function" |
Christian Heimes | 4d6ec85 | 2008-03-26 22:34:47 +0000 | [diff] [blame] | 28 | #define FUTURE_UNICODE_LITERALS "unicode_literals" |
Guido van Rossum | 4668b00 | 2001-08-08 05:00:18 +0000 | [diff] [blame] | 29 | |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 30 | struct _mod; /* Declare the existence of this type */ |
Neal Norwitz | 38eb50b | 2005-10-23 19:06:02 +0000 | [diff] [blame] | 31 | PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 32 | PyCompilerFlags *, PyArena *); |
Neal Norwitz | 38eb50b | 2005-10-23 19:06:02 +0000 | [diff] [blame] | 33 | PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 34 | |
| 35 | #define ERR_LATE_FUTURE \ |
| 36 | "from __future__ imports must occur at the beginning of the file" |
| 37 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 38 | #ifdef __cplusplus |
| 39 | } |
| 40 | #endif |
| 41 | #endif /* !Py_COMPILE_H */ |