mirror of https://github.com/python/cpython
3e0a6f37df
`ast.parse` and `compile` support a `feature_version` parameter that tells the parser to parse the input string, as if it were written in an older Python version. The `feature_version` is propagated to the tokenizer, which uses it to handle the three different stages of support for `async` and `await`. Additionally, it disallows the following at parser level: - The '@' operator in < 3.5 - Async functions in < 3.5 - Async comprehensions in < 3.6 - Underscores in numeric literals in < 3.6 - Await expression in < 3.5 - Variable annotations in < 3.6 - Async for-loops in < 3.5 - Async with-statements in < 3.5 - F-strings in < 3.6 Closes we-like-parsers/cpython#124. |
||
---|---|---|
.. | ||
pegen | ||
pgen | ||
Python.asdl | ||
acceler.c | ||
asdl.py | ||
asdl_c.py | ||
grammar1.c | ||
listnode.c | ||
myreadline.c | ||
node.c | ||
parser.c | ||
parser.h | ||
parsetok.c | ||
token.c | ||
tokenizer.c | ||
tokenizer.h |