diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-09-06 06:28:06 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-09-06 06:28:06 (GMT) |
commit | ca460d9722c9542004c4cf34d9231641ac18e34b (patch) | |
tree | b007e31668de7ff4b37e0c8d80dc575e8b600118 /Python | |
parent | 98775dfebc86aca40b27dcca5e4f4fd3a07e8acb (diff) | |
download | cpython-ca460d9722c9542004c4cf34d9231641ac18e34b.zip cpython-ca460d9722c9542004c4cf34d9231641ac18e34b.tar.gz cpython-ca460d9722c9542004c4cf34d9231641ac18e34b.tar.bz2 |
with and as are now keywords. There are some generated files I can't recreate.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 12 | ||||
-rw-r--r-- | Python/graminit.c | 17 | ||||
-rw-r--r-- | Python/pythonrun.c | 7 |
3 files changed, 14 insertions, 22 deletions
diff --git a/Python/ast.c b/Python/ast.c index 4883cc2..9e0c184 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -2190,10 +2190,6 @@ alias_for_import_name(struct compiling *c, const node *n) case import_as_name: str = NULL; if (NCH(n) == 3) { - if (strcmp(STR(CHILD(n, 1)), "as") != 0) { - ast_error(n, "must use 'as' in import"); - return NULL; - } str = NEW_IDENTIFIER(CHILD(n, 2)); } return alias(NEW_IDENTIFIER(CHILD(n, 0)), str, c->c_arena); @@ -2206,10 +2202,6 @@ alias_for_import_name(struct compiling *c, const node *n) alias_ty a = alias_for_import_name(c, CHILD(n, 0)); if (!a) return NULL; - if (strcmp(STR(CHILD(n, 1)), "as") != 0) { - ast_error(n, "must use 'as' in import"); - return NULL; - } assert(!a->asname); a->asname = NEW_IDENTIFIER(CHILD(n, 2)); return a; @@ -2848,10 +2840,6 @@ static expr_ty ast_for_with_var(struct compiling *c, const node *n) { REQ(n, with_var); - if (strcmp(STR(CHILD(n, 0)), "as") != 0) { - ast_error(n, "expected \"with [expr] as [var]\""); - return NULL; - } return ast_for_expr(c, CHILD(n, 1)); } diff --git a/Python/graminit.c b/Python/graminit.c index 8f20502..33ef64b 100644 --- a/Python/graminit.c +++ b/Python/graminit.c @@ -551,9 +551,8 @@ static state states_26[8] = { static arc arcs_27_0[1] = { {19, 1}, }; -static arc arcs_27_1[3] = { +static arc arcs_27_1[2] = { {78, 2}, - {19, 2}, {0, 1}, }; static arc arcs_27_2[1] = { @@ -564,16 +563,15 @@ static arc arcs_27_3[1] = { }; static state states_27[4] = { {1, arcs_27_0}, - {3, arcs_27_1}, + {2, arcs_27_1}, {1, arcs_27_2}, {1, arcs_27_3}, }; static arc arcs_28_0[1] = { {12, 1}, }; -static arc arcs_28_1[3] = { +static arc arcs_28_1[2] = { {78, 2}, - {19, 2}, {0, 1}, }; static arc arcs_28_2[1] = { @@ -584,7 +582,7 @@ static arc arcs_28_3[1] = { }; static state states_28[4] = { {1, arcs_28_0}, - {3, arcs_28_1}, + {2, arcs_28_1}, {1, arcs_28_2}, {1, arcs_28_3}, }; @@ -912,9 +910,8 @@ static state states_40[6] = { {1, arcs_40_4}, {1, arcs_40_5}, }; -static arc arcs_41_0[2] = { +static arc arcs_41_0[1] = { {78, 1}, - {19, 1}, }; static arc arcs_41_1[1] = { {82, 2}, @@ -923,7 +920,7 @@ static arc arcs_41_2[1] = { {0, 2}, }; static state states_41[3] = { - {2, arcs_41_0}, + {1, arcs_41_0}, {1, arcs_41_1}, {1, arcs_41_2}, }; @@ -1865,7 +1862,7 @@ static dfa dfas[84] = { {296, "with_stmt", 0, 6, states_40, "\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000"}, {297, "with_var", 0, 3, states_41, - "\000\000\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"}, {298, "except_clause", 0, 5, states_42, "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"}, {299, "suite", 0, 5, states_43, diff --git a/Python/pythonrun.c b/Python/pythonrun.c index e8f4fa2..634572e 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -725,9 +725,16 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag /* compute parser flags based on compiler flags */ #define PARSER_FLAGS(flags) \ ((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \ + PyPARSE_DONT_IMPLY_DEDENT : 0)) : 0) + +#if 0 +/* Keep an example of flags with future keyword support. */ +#define PARSER_FLAGS(flags) \ + ((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \ PyPARSE_DONT_IMPLY_DEDENT : 0) \ | ((flags)->cf_flags & CO_FUTURE_WITH_STATEMENT ? \ PyPARSE_WITH_IS_KEYWORD : 0)) : 0) +#endif int PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) |