aboutsummaryrefslogtreecommitdiff
path: root/Grammar
AgeCommit message (Collapse)Author
2022-02-10bpo-46707: Avoid potential exponential backtracking in some syntax errors ↵Pablo Galindo Salgado
(GH-31241)
2022-01-09bpo-46272: Fix two heading comments in python.gram (GH-30499)Mark Dickinson
One typo fix and one heading change, both in comments. No functional changes.
2021-12-14bpo-45292: [PEP-654] add except* (GH-29581)Irit Katriel
2021-11-24bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if ↵Pablo Galindo Salgado
inside parentheses (GH-29757)
2021-11-20bpo-45450: Improve syntax error for parenthesized arguments (GH-28906)Pablo Galindo Salgado
2021-11-19bpo-45727: Make the syntax error for missing comma more consistent (GH-29427)Pablo Galindo Salgado
2021-11-09bpo-45764: improve error message when missing '(' after 'def' (GH-29484)Carl Friedrich Bolz-Tereick
to achieve this, change the grammar to expect the '(' token after 'def' NAME. Automerge-Triggered-By: GH:pablogsal
2021-11-05bpo-45716: Improve the error message when using True/False/None as keywords ↵Pablo Galindo Salgado
in a call (GH-29413)
2021-11-03bpo-44257: fix "assigment_expr" typo + regenerate the grammar, and remove ↵wim glenn
unused imports (GH-29393) Co-authored-by: Wim Glenn <wglenn@jumptrading.com>
2021-09-27bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator ↵Pablo Galindo Salgado
expression in function calls (GH-28576)
2021-08-18bpo-44947: Refine the syntax error for trailing commas in import statements ↵Pablo Galindo Salgado
(GH-27814)
2021-08-05bpo-44838: Refine the custom syntax errors for invalid 'if' expressions ↵Pablo Galindo Salgado
(GH-27615)
2021-08-02bpo-44792: Improve syntax errors for if expressions (GH-27506)Miguel Brito
2021-08-01bpo-34013: Don't consider a grouped expression when reporting legacy print ↵Pablo Galindo Salgado
syntax errors (GH-27521)
2021-07-31Divide the grammar into sections to improve readability (GH-27502)Pablo Galindo Salgado
2021-07-27bpo-34013: Move the Python 2 hints from the exception constructor to the ↵Pablo Galindo Salgado
parser (GH-27392)
2021-07-27bpo-34013: Generalize the invalid legacy statement error message (GH-27389)Pablo Galindo Salgado
2021-07-16Remove unnecessary 'invalid_primary' rule in the parser (GH-27186)Pablo Galindo Salgado
2021-06-24bpo-44456: Improve the syntax error when mixing keyword and positional ↵Pablo Galindo
patterns (GH-26793)
2021-06-10bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632)Pablo Galindo
2021-06-10bpo-44385: Remove unused grammar rules (GH-26655)Lysandros Nikolaou
Automerge-Triggered-By: GH:lysnikolaou
2021-06-03bpo-44305: Improve syntax error for try blocks without except or finally ↵Pablo Galindo
(GH-26523)
2021-05-21bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283)Pablo Galindo
The invalid assignment rules are very delicate since the parser can easily raise an invalid assignment when a keyword argument is provided. As they are very deep into the grammar tree, is very difficult to specify in which contexts these rules can be used and in which don't. For that, we need to use a different version of the rule that doesn't do error checking in those situations where we don't want the rule to raise (keyword arguments and generator expressions). We also need to check if we are in left-recursive rule, as those can try to eagerly advance the parser even if the parse will fail at the end of the expression. Failing to do this allows the parser to start parsing a call as a tuple and incorrectly identify a keyword argument as an invalid assignment, before it realizes that it was not a tuple after all.
2021-05-19bpo-44168: Fix error message in the parser for keyword arguments for invalid ↵Pablo Galindo
expressions (GH-26210)
2021-05-08bpo-43149: Correct the syntax error message for multiple exception types ↵Pablo Galindo
(GH-25996) Automerge-Triggered-By: GH:pablogsal
2021-04-29bpo-43892: Validate the first term of complex literal value patterns (GH-25735)Brandt Bucher
2021-04-28bpo-43892: Make match patterns explicit in the AST (GH-25585)Nick Coghlan
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2021-04-23bpo-43914: Highlight invalid ranges in SyntaxErrors (#25525)Pablo Galindo
To improve the user experience understanding what part of the error messages associated with SyntaxErrors is wrong, we can highlight the whole error range and not only place the caret at the first character. In this way: >>> foo(x, z for z in range(10), t, w) File "<stdin>", line 1 foo(x, z for z in range(10), t, w) ^ SyntaxError: Generator expression must be parenthesized becomes >>> foo(x, z for z in range(10), t, w) File "<stdin>", line 1 foo(x, z for z in range(10), t, w) ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Generator expression must be parenthesized
2021-04-21bpo-43859: Improve the error message for IndentationError exceptions (GH-25431)Pablo Galindo
2021-04-16bpo-43823: Fix location of one of the errors for invalid dictionary literals ↵Pablo Galindo
(GH-25427)
2021-04-15bpo-43822: Improve syntax errors for missing commas (GH-25377)Pablo Galindo
2021-04-15bpo-43823: Improve syntax errors for invalid dictionary literals (GH-25378)Pablo Galindo
2021-04-13bpo-43797: Handle correctly invalid assignments inside function calls and ↵Pablo Galindo
generators (GH-25390)
2021-04-13Ensure that early = are not matched by the parser as invalid comparisons ↵Pablo Galindo
(GH-25375)
2021-04-12bpo-43797: Improve syntax error for invalid comparisons (#25317)Pablo Galindo
* bpo-43797: Improve syntax error for invalid comparisons * Update Lib/test/test_fstring.py Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> * Apply review comments * can't -> cannot Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2021-04-10bpo-43798: Add source location attributes to alias (GH-25324)Matthew Suozzo
* Add source location attributes to alias. * Move alias star construction to pegen helper. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-04-07bpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() (GH-25252)Victor Stinner
Rename AST functions of pycore_ast.h to use the "_PyAST_" prefix. Remove macros creating aliases without prefix. For example, Module() becomes _PyAST_Module(). Update Grammar/python.gram to use _PyAST_xxx() functions.
2021-03-24bpo-41064: Improve syntax error for invalid usage of '**' in f-strings ↵Pablo Galindo
(GH-25006)
2021-03-18bpo-42128: Add 'missing :' syntax error message to match statements (GH-24733)Pablo Galindo
2021-02-26bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917)Brandt Bucher
Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Talin <viridia@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-02-07bpo-43149: Improve error message for exception group without parentheses ↵Pablo Galindo
(GH-24467)
2021-02-03bpo-43121: Fix incorrect SyntaxError message for missing comma (GH-24436)Pablo Galindo
2021-02-02bpo-42997: Improve error message for missing : before suites (GH-24292)Pablo Galindo
* Add to the peg generator a new directive ('&&') that allows to expect a token and hard fail the parsing if the token is not found. This allows to quickly emmit syntax errors for missing tokens. * Use the new grammar element to hard-fail if the ':' is missing before suites.
2021-01-31bpo-43017: Improve error message for unparenthesised tuples in ↵Pablo Galindo
comprehensions (GH24314)
2021-01-07bpo-42860: Remove type error from grammar (GH-24156)Lysandros Nikolaou
This is only there so that alternative implementations written in statically-typed languages can use this grammar without having type errors in the way. Automerge-Triggered-By: GH:lysnikolaou
2021-01-03bpo-40631: Disallow single parenthesized star target (GH-24027)Lysandros Nikolaou
2020-12-13bpo-30858: Improve error location for expressions with assignments (GH-23753)Pablo Galindo
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-11-30Refactor the grammar to match the language specification docs (GH-23574)Pablo Galindo
2020-11-17bpo-42381: Allow walrus in set literals and set comprehensions (GH-23332)Pablo Galindo
Currently walruses are not allowerd in set literals and set comprehensions: >>> {y := 4, 4**2, 3**3} File "<stdin>", line 1 {y := 4, 4**2, 3**3} ^ SyntaxError: invalid syntax but they should be allowed as well per PEP 572
2020-11-17bpo-42316: Allow unparenthesized walrus operator in indexes (GH-23317)Lysandros Nikolaou