summaryrefslogtreecommitdiffstats
path: root/Parser/parser.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-110938: Fix error messages for indented blocks with functio… ↵Jelle Zijlstra2023-10-181-19/+31
| | | | | | | | (#110990) [3.12] gh-110938: Fix error messages for indented blocks with functions and classes with generic type parameters (GH-110973) (cherry picked from commit 24e4ec7766fd471deb5b7e5087f0e7dba8576cfb) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.12] gh-110696: Fix incorrect syntax error message for incorrect argument ↵Pablo Galindo Salgado2023-10-121-1133/+1485
| | | | | unpacking (GH-110706) (#110765) (cherry picked from commit 3d180347ae73119bb51500efeeafdcd62bcc6f78)
* [3.12] gh-109596: Ensure repeated rules in the grammar are not allowed and ↵Pablo Galindo Salgado2023-10-021-1182/+1180
| | | | | fix incorrect soft keywords (GH-109606). (#109752) (cherry picked from commit b28ffaa193efc66f46ab90d383279174a11a11d7)
* [3.12] gh-109114: Relax the check for invalid lambdas inside f-strings to ↵Pablo Galindo Salgado2023-09-121-1124/+1065
| | | | | | | | avoid false positives (GH-109121). (#109155) (cherry picked from commit 5bda2f637e1cfbca45a83aa6e22db25498064b27) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* [3.12] gh-108179: Add error message for parser stack overflows (GH-108256) ↵Miss Islington (bot)2023-08-221-1060/+530
| | | | | | | | (#108263) gh-108179: Add error message for parser stack overflows (GH-108256) (cherry picked from commit 86617518c4ac824e2b6dc20691ba5a08df04f285) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* [3.12] gh-98931: Add custom error messages to invalid import/from with ↵Miss Islington (bot)2023-06-221-596/+719
| | | | | | | multiple targets (GH-105985) (#105991) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* [3.12] gh-105194: Fix format specifier escaped characters in f-strings ↵Miss Islington (bot)2023-06-021-1/+1
| | | | (GH-105231) (#105234)
* [3.12] gh-104799: Move location of type_params AST fields (GH-104828) (#104974)Miss Islington (bot)2023-05-301-3/+3
| | | | | | | gh-104799: Move location of type_params AST fields (GH-104828) (cherry picked from commit ba73473f4c18ba4cf7ab18d84d94a47d2d37a0c5) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104656: Rename typeparams AST node to type_params (#104657)Jelle Zijlstra2023-05-221-15/+15
|
* gh-103763: Implement PEP 695 (#103764)Jelle Zijlstra2023-05-161-1958/+2557
| | | | | | | | | | | | | | This implements PEP 695, Type Parameter Syntax. It adds support for: - Generic functions (def func[T](): ...) - Generic classes (class X[T](): ...) - Type aliases (type X = ...) - New scoping when the new syntax is used within a class body - Compiler and interpreter changes to support the new syntax and scoping rules Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Eric Traut <eric@traut.com> Co-authored-by: Larry Hastings <larry@hastings.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-103656: Transfer f-string buffers to parser to avoid use-after-free ↵Lysandros Nikolaou2023-04-271-12/+12
| | | | | (GH-103896) Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* gh-102856: Initial implementation of PEP 701 (#102855)Pablo Galindo Salgado2023-04-191-2434/+4636
| | | | | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Batuhan Taskaya <isidentical@gmail.com> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
* gh-102416: Do not memoize incorrectly loop rules in the parser (#102467)Pablo Galindo Salgado2023-03-061-216/+0
|
* gh-101046: Fix a potential memory leak in the parser when raising ↵Pablo Galindo Salgado2023-01-161-0/+108
| | | | MemoryError (#101051)
* gh-90994: Improve error messages upon call arguments syntax errors (GH-96893)Lysandros Nikolaou2022-11-201-1149/+1395
|
* gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215)Lysandros Nikolaou2022-11-201-671/+713
| | | Automerge-Triggered-By: GH:lysnikolaou
* gh-99153: set location on SyntaxError for try with both except and except* ↵Irit Katriel2022-11-061-3/+3
| | | | (GH-99160)
* gh-98931: Improve error message when the user types 'import x from y' ↵Pablo Galindo Salgado2022-11-011-391/+465
| | | | instead of 'from y import x' (#98932)
* gh-91210: Improve error message when non-default param follows default ↵Lysandros Nikolaou2022-09-171-345/+353
| | | | | | (GH-95933) - Improve error message when parameter without a default follows one with a default - Show same error message when positional-only params precede the default/non-default sequence
* gh-96587: Raise `SyntaxError` for PEP654 on older `feature_version` (#96588)Nikita Sobolev2022-09-051-1/+1
|
* gh-94996: Disallow lambda pos only params with feature_version < (3, 8) ↵Shantanu2022-08-121-2/+2
| | | | (GH-95934)
* gh-94996: Disallow parsing pos only params with feature_version < (3, 8) ↵Shantanu2022-08-121-2/+2
| | | | (GH-94997)
* gh-94949: Disallow parsing parenthesised ctx mgr with old feature_version ↵Shantanu2022-07-181-1/+1
| | | | | | | | | | | (#94950) * gh-94949: Disallow parsing parenthesised ctx manager with old feature_version * 📜🤖 Added by blurb_it. * Allow it with feature_version=(3, 9) as well Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-94947: Disallow parsing walrus with feature_version < (3, 8) (#94948)Shantanu2022-07-181-1/+1
| | | | | | | | | * gh-94947: Disallow parsing walrus with feature_version < (3, 8) * oops, commit the parser * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-94192: Fix error for dictionary literals with invalid expression as ↵wookie1842022-06-261-261/+326
| | | | | | | value. (#94304) * Fix error for dictionary literals with invalid expression as value. * Remove trailing whitespace
* gh-92858: Improve error message for some suites with syntax error before ':' ↵wookie1842022-06-231-362/+500
| | | | (#92894)
* gh-93671: Avoid exponential backtracking in deeply nested sequence patterns ↵Pablo Galindo Salgado2022-06-101-0/+10
| | | | | in match statements (GH-93680) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-93103: Parser uses PyConfig.parser_debug instead of Py_DebugFlag (#93106)Victor Stinner2022-05-241-1/+1
| | | | | | | * Replace deprecated Py_DebugFlag with PyConfig.parser_debug in the parser. * Add Parser.debug member. * Add tok_state.debug member. * Py_FrozenMain(): Replace Py_VerboseFlag with PyConfig.verbose.
* gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803)Christian Heimes2022-05-191-1/+5
|
* bpo-47212: Improve error messages for un-parenthesized generator expressions ↵Matthieu Dartiailh2022-04-051-3/+3
| | | | (GH-32302)
* bpo-43224: Implement PEP 646 grammar changes (GH-31018)Matthew Rahtz2022-03-261-2101/+2465
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-46838: Syntax error improvements for function definitions (GH-31590)Pablo Galindo Salgado2022-03-221-867/+3150
|
* Allow the parser to avoid nested processing of invalid rules (GH-31252)Pablo Galindo Salgado2022-02-101-1042/+1032
|
* bpo-46707: Avoid potential exponential backtracking in some syntax errors ↵Pablo Galindo Salgado2022-02-101-1015/+1020
| | | | (GH-31241)
* bpo-46110: Restore commit e9898bf153d26059261ffef11f7643ae991e2a4cPablo Galindo Salgado2022-01-031-3193/+4580
| | | This restores commit e9898bf153d26059261ffef11f7643ae991e2a4c .
* Revert "bpo-46110: Add a recursion check to avoid stack overflow in the PEG ↵Pablo Galindo Salgado2022-01-031-4580/+3193
| | | | | parser (GH-30177)" (GH-30363) This reverts commit e9898bf153d26059261ffef11f7643ae991e2a4c temporarily as we want to confirm if this commit is the cause of a slowdown at startup time.
* bpo-46110: Add a recursion check to avoid stack overflow in the PEG parser ↵Pablo Galindo Salgado2021-12-201-3193/+4580
| | | | | (GH-30177) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
* bpo-45292: [PEP-654] add except* (GH-29581)Irit Katriel2021-12-141-1776/+2720
|
* bpo-45866: pegen strips directory of "generated from" header (GH-29777)Victor Stinner2021-11-261-1/+1
| | | | | "make regen-all" now produces the same output when run from a directory other than the source tree: when building Python out of the source tree.
* bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if ↵Pablo Galindo Salgado2021-11-241-1/+1
| | | | inside parentheses (GH-29757)
* bpo-45450: Improve syntax error for parenthesized arguments (GH-28906)Pablo Galindo Salgado2021-11-201-445/+849
|
* bpo-45727: Make the syntax error for missing comma more consistent (GH-29427)Pablo Galindo Salgado2021-11-191-21/+21
|
* bpo-45764: improve error message when missing '(' after 'def' (GH-29484)Carl Friedrich Bolz-Tereick2021-11-091-12/+12
| | | | | to achieve this, change the grammar to expect the '(' token after 'def' NAME. Automerge-Triggered-By: GH:pablogsal
* bpo-45716: Improve the error message when using True/False/None as keywords ↵Pablo Galindo Salgado2021-11-051-689/+795
| | | | in a call (GH-29413)
* bpo-44257: fix "assigment_expr" typo + regenerate the grammar, and remove ↵wim glenn2021-11-031-60/+60
| | | | | | unused imports (GH-29393) Co-authored-by: Wim Glenn <wglenn@jumptrading.com>
* bpo-45494: Fix parser crash when reporting errors involving invalid ↵Pablo Galindo Salgado2021-10-191-120/+120
| | | | | | | | | | | | continuation characters (GH-28993) There are two errors that this commit fixes: * The parser was not correctly computing the offset and the string source for E_LINECONT errors due to the incorrect usage of strtok(). * The parser was not correctly unwinding the call stack when a tokenizer exception happened in rules involving optionals ('?', [...]) as we always make them return valid results by using the comma operator. We need to check first if we don't have an error before continuing.
* bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator ↵Pablo Galindo Salgado2021-09-271-3/+3
| | | | expression in function calls (GH-28576)
* Extract visitors from the grammar nodes and call makers in the peg generator ↵Pablo Galindo Salgado2021-09-051-167/+167
| | | | | (GH-28172) Simplify the peg generator logic by extracting as much visitors as possible to disentangle the flow and separate concerns.
* bpo-44947: Refine the syntax error for trailing commas in import statements ↵Pablo Galindo Salgado2021-08-181-5/+8
| | | | (GH-27814)
* Update pegen to use the latest upstream developments (GH-27586)Pablo Galindo Salgado2021-08-121-41/+41
|