Mercurial > cpython-lru_cache-weakref
diff Parser/parser.c @ 22466:1db1510abe21 legacy-trunk
Disable the parser hacks that allowed the "yield" keyword to be enabled
by a future statement.
| author | Neil Schemenauer <nascheme@enme.ucalgary.ca> |
|---|---|
| date | Fri, 22 Mar 2002 23:38:11 +0000 |
| parents | 944d6e02f359 |
| children | bbf16fd024df |
line wrap: on
line diff
--- a/Parser/parser.c Fri Mar 22 23:20:15 2002 +0000 +++ b/Parser/parser.c Fri Mar 22 23:38:11 2002 +0000 @@ -79,7 +79,9 @@ if (ps == NULL) return NULL; ps->p_grammar = g; +#if 0 /* future keyword */ ps->p_generators = 0; +#endif ps->p_tree = PyNode_New(start); if (ps->p_tree == NULL) { PyMem_DEL(ps); @@ -145,10 +147,12 @@ if (l->lb_type == NAME && l->lb_str != NULL && l->lb_str[0] == s[0] && strcmp(l->lb_str, s) == 0) { +#if 0 /* future keyword */ if (!ps->p_generators && s[0] == 'y' && strcmp(s, "yield") == 0) break; /* not a keyword */ +#endif D(printf("It's a keyword\n")); return n - i; } @@ -170,6 +174,7 @@ return -1; } +#if 0 /* future keyword */ static void future_hack(parser_state *ps) { @@ -191,6 +196,7 @@ } } } +#endif /* future keyword */ int PyParser_AddToken(register parser_state *ps, register int type, char *str, @@ -249,10 +255,12 @@ "Direct pop.\n", d->d_name, ps->p_stack.s_top->s_state)); +#if 0 /* future keyword */ if (d->d_name[0] == 'i' && strcmp(d->d_name, "import_stmt") == 0) future_hack(ps); +#endif s_pop(&ps->p_stack); if (s_empty(&ps->p_stack)) { D(printf(" ACCEPT.\n")); @@ -265,9 +273,11 @@ } if (s->s_accept) { +#if 0 /* future keyword */ if (d->d_name[0] == 'i' && strcmp(d->d_name, "import_stmt") == 0) future_hack(ps); +#endif /* Pop this dfa and try again */ s_pop(&ps->p_stack); D(printf(" Pop ...\n"));
