summaryrefslogtreecommitdiff
path: root/Parser/pegen/pegen.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40334: Add support for feature_version in new PEG parser (GH-19827)Lysandros Nikolaou2020-04-301-4/+17
| | | | | | | | | | | | | | | | | | | `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.
* bpo-40334: Support type comments (GH-19780)Guido van Rossum2020-04-301-4/+147
| | | | | | | | | | This implements full support for # type: <type> comments, # type: ignore <stuff> comments, and the func_type parsing mode for ast.parse() and compile(). Closes https://github.com/we-like-parsers/cpython/issues/95. (For now, you need to use the master branch of mypy, since another issue unique to 3.9 had to be fixed there, and there's no mypy release yet.) The only thing missing is `feature_version=N`, which is being tracked in https://github.com/we-like-parsers/cpython/issues/124.
* bpo-40334: refactor and cleanup for the PEG generators (GH-19775)Pablo Galindo2020-04-291-46/+0
|
* bpo-40334: Disallow invalid single statements in the new parser (GH-19774)Lysandros Nikolaou2020-04-291-0/+51
| | | | | After parsing is done in single statement mode, the tokenizer buffer has to be checked for additional lines and a `SyntaxError` must be raised, in case there are any. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40334: Explicitly cast to int in pegen.c to fix a compiler warning ↵Pablo Galindo2020-04-291-4/+4
| | | | (GH-19779)
* bpo-40334: Catch E_EOF error, when the tokenizer returns ERRORTOKEN (GH-19743)Lysandros Nikolaou2020-04-281-3/+6
| | | An E_EOF error was only being caught after the parser exited before this commit. There are some cases though, where the tokenizer returns ERRORTOKEN *and* has set an E_EOF error (like when EOF directly follows a line continuation character) which weren't correctly handled before.
* bpo-40334: Support PyPARSE_DONT_IMPLY_DEDENT in the new parser (GH-19736)Pablo Galindo2020-04-271-1/+1
|
* bpo-40334: Support CO_FUTURE_BARRY_AS_BDFL in the new parser (GH-19721)Pablo Galindo2020-04-271-9/+52
| | | This commit also allows to pass flags to the new parser in all interfaces and fixes a bug in the parser generator that was causing to inline rules with actions, making them disappear.
* Use Py_ssize_t instead of ssize_t (GH-19685)Pablo Galindo2020-04-241-1/+1
|
* bpo-40334: Improve various PEG-Parser related stuff (GH-19669)Lysandros Nikolaou2020-04-231-27/+49
| | | The changes in this commit are all related to @vstinner's original review comments of the initial PEP 617 implementation PR.
* bpo-40334: Fix build errors and warnings in test_peg_generator (GH-19672)Pablo Galindo2020-04-231-1/+11
|
* bpo-40334: Don't downcast from Py_ssize_t to int (GH-19671)Pablo Galindo2020-04-231-21/+21
|
* bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)Pablo Galindo2020-04-221-0/+1865
Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>