summaryrefslogtreecommitdiffstats
path: root/Parser
Commit message (Collapse)AuthorAgeFilesLines
* bpo-44792: Improve syntax errors for if expressions (GH-27506)Miguel Brito2021-08-021-0/+33
|
* bpo-34013: Don't consider a grouped expression when reporting legacy print ↵Pablo Galindo Salgado2021-08-011-5/+7
| | | | syntax errors (GH-27521)
* Divide the grammar into sections to improve readability (GH-27502)Pablo Galindo Salgado2021-07-311-6585/+6583
|
* Update URLs in comments and metadata to use HTTPS (GH-27458)Noah Kantrowitz2021-07-301-1/+1
|
* bpo-34013: Move the Python 2 hints from the exception constructor to the ↵Pablo Galindo Salgado2021-07-271-7/+7
| | | | parser (GH-27392)
* bpo-34013: Generalize the invalid legacy statement error message (GH-27389)Pablo Galindo Salgado2021-07-273-243/+322
|
* bpo-43950: Distinguish errors happening on character offset decoding (GH-27217)Batuhan Taskaya2021-07-201-5/+13
|
* Remove unnecessary 'invalid_primary' rule in the parser (GH-27186)Pablo Galindo Salgado2021-07-161-304/+237
|
* bpo-44317: Improve tokenizer errors with more informative locations (GH-26555)Pablo Galindo Salgado2021-07-101-18/+54
|
* bpo-43950: Print columns in tracebacks (PEP 657) (GH-26958)Ammar Askar2021-07-042-23/+24
| | | | | | | | The traceback.c and traceback.py mechanisms now utilize the newly added code.co_positions and PyCode_Addr2Location to print carets on the specific expressions involved in a traceback. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Ammar Askar <ammar@ammaraskar.com> Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
* bpo-40528: fix is_simple(sum)s behavior for attributes (GH-26918)Batuhan Taskaya2021-06-271-6/+10
| | | | | | | | This is something I noticed while (now discontinued) experimenting with the idea of annotating operators with location information. Unfortunately without this addition, adding any `attributes` to stuff like `unaryop` doesn't change anything since the code assumes they are singletons and caches all instances. This patch fixes this assumption with including the attributes as well as constructor fields.
* bpo-44456: Improve the syntax error when mixing keyword and positional ↵Pablo Galindo2021-06-243-464/+638
| | | | patterns (GH-26793)
* bpo-40528: move asdl identifier collection to the new metadata system (GH-26858)Batuhan Taskaya2021-06-241-49/+51
|
* bpo-40528: Implement a metadata system for ASDL Generator (GH-20193)Batuhan Taskaya2021-06-221-24/+75
| | | | | | | | ASDL Generator was lack of proper annotation related to generated module. This patch implements a MetadataVisitor that produces a metadata object to pass to other visitors that are visiting that same module. For the inital patch, it dynamically retrieves int sequences (like cmpop), that was previously hardcoded. It offers an interface that is easy to extend.
* bpo-44409: Fix error location in tokenizer errors that happen during ↵Pablo Galindo2021-06-141-0/+1
| | | | initialization (GH-26712)
* Fix typos in multiple files (GH-26689)Binbin2021-06-131-3/+3
| | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-44396: Update multi-line-start location when reallocating tokenizer ↵Pablo Galindo2021-06-121-0/+5
| | | | | buffers (GH-26676) Automerge-Triggered-By: GH:pablogsal
* Add more const modifiers. (GH-26691)Serhiy Storchaka2021-06-123-15/+15
|
* bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632)Pablo Galindo2021-06-101-213/+313
|
* bpo-44385: Remove unused grammar rules (GH-26655)Lysandros Nikolaou2021-06-101-1256/+791
| | | Automerge-Triggered-By: GH:lysnikolaou
* bpo-44368: Ensure we don't raise incorrect custom syntax errors with soft ↵Pablo Galindo2021-06-091-4/+11
| | | | keywords (GH-26630)
* bpo-44345: Fix 'generated by' comment in parser.c (GH-26615)Akira Nonaka2021-06-091-1/+1
|
* bpo-44349: Fix edge case when displaying text from files with encoding in ↵Pablo Galindo2021-06-081-2/+5
| | | | syntax errors (GH-26611)
* bpo-43833: Emit warnings for numeric literals followed by keyword (GH-25466)Serhiy Storchaka2021-06-081-0/+128
| | | | | | | | Emit a deprecation warning if the numeric literal is immediately followed by one of keywords: and, else, for, if, in, is, or. Raise a syntax error with more informative message if it is immediately followed by other keyword or identifier. Automerge-Triggered-By: GH:pablogsal
* bpo-44335: Ensure the tokenizer doesn't go into Python with the error set ↵Pablo Galindo2021-06-081-3/+17
| | | | (GH-26608)
* bpo-44335: Fix a regression when identifying invalid characters in syntax ↵Pablo Galindo2021-06-081-1/+3
| | | | errors (GH-26589)
* fix: use unambiguous punction in 'invalid escape sequence' message (GH-26582)Ned Batchelder2021-06-081-2/+2
|
* bpo-44305: Improve syntax error for try blocks without except or finally ↵Pablo Galindo2021-06-031-269/+358
| | | | (GH-26523)
* bpo-11105: Do not crash when compiling recursive ASTs (GH-20594)Batuhan Taskaya2021-06-031-4/+15
| | | | | | | When compiling an AST object with a direct / indirect reference cycles, on the conversion phase because of exceeding amount of calls, a segfault was raised. This patch adds recursion guards to places for preventing user inputs to not to crash AST but instead raise a RecursionError.
* bpo-44273: Improve syntax error message for assigning to "..." (GH-26477)Serhiy Storchaka2021-06-011-1/+1
| | | Use "ellipsis" instead of "Ellipsis" in syntax error messages to eliminate confusion with built-in variable Ellipsis.
* bpo-44201: Avoid side effects of "invalid_*" rules in the REPL (GH-26298)Pablo Galindo2021-05-223-0/+22
| | | | | | | | | | | | When the parser does a second pass to check for errors, these rules can have some small side-effects as they may advance the parser more than the point reached in the first pass. This can cause the tokenizer to ask for extra tokens in interactive mode causing the tokenizer to show the prompt instead of failing instantly. To avoid this, add a new mode to the tokenizer that is activated in the second pass and deactivates asking for new tokens when the interactive line is finished. As the parsing should have reached the last line in the first pass, the second pass should not need to ask for more tokens.
* bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283)Pablo Galindo2021-05-213-1172/+1403
| | | | | | | | | | | | | | | 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.
* bpo-44180: Report generic syntax errors in the furthest position reached in ↵Pablo Galindo2021-05-211-1/+6
| | | | the first parser pass (GH-26253)
* bpo-44168: Fix error message in the parser for keyword arguments for invalid ↵Pablo Galindo2021-05-191-541/+584
| | | | expressions (GH-26210)
* bpo-44143: Fix crash in the parser when raising tokenizer errors with an ↵Pablo Galindo2021-05-151-0/+1
| | | | exception set (GH-26144)
* bpo-43149: Correct the syntax error message for multiple exception types ↵Pablo Galindo2021-05-081-1/+1
| | | | | (GH-25996) Automerge-Triggered-By: GH:pablogsal
* bpo-43822: Prioritize tokenizer errors over custom syntax errors when ↵Pablo Galindo2021-05-041-0/+3
| | | | raising parser exceptions (GH-25866)
* bpo-43892: Validate the first term of complex literal value patterns (GH-25735)Brandt Bucher2021-04-303-397/+526
|
* bpo-43892: Make match patterns explicit in the AST (GH-25585)Nick Coghlan2021-04-294-745/+1352
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection ↵Segev Finer2021-04-231-4/+2
| | | | | | | | (GH-1927) This works by not caching the handle and instead getting the handle from the file descriptor each time, so that if the actual handle changes by fd redirection closing/opening the console handle beneath our feet, we will keep working correctly.
* bpo-43914: Highlight invalid ranges in SyntaxErrors (#25525)Pablo Galindo2021-04-233-471/+596
| | | | | | | | | | | | | | | | | 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
* bpo-43859: Improve the error message for IndentationError exceptions (GH-25431)Pablo Galindo2021-04-211-541/+1975
|
* bpo-43823: Fix location of one of the errors for invalid dictionary literals ↵Pablo Galindo2021-04-151-1/+1
| | | | (GH-25427)
* bpo-43822: Improve syntax errors for missing commas (GH-25377)Pablo Galindo2021-04-154-637/+796
|
* bpo-43823: Improve syntax errors for invalid dictionary literals (GH-25378)Pablo Galindo2021-04-151-364/+778
|
* bpo-43797: Handle correctly invalid assignments inside function calls and ↵Pablo Galindo2021-04-131-6/+6
| | | | generators (GH-25390)
* Ensure that early = are not matched by the parser as invalid comparisons ↵Pablo Galindo2021-04-131-318/+413
| | | | (GH-25375)
* bpo-43797: Improve syntax error for invalid comparisons (#25317)Pablo Galindo2021-04-122-592/+1152
| | | | | | | | | | | | | * 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>
* bpo-43798: Add source location attributes to alias (GH-25324)Matthew Suozzo2021-04-104-7/+62
| | | | | | | * 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>
* Simplify _PyPegen_fill_token in pegen.c (GH-25295)Pablo Galindo2021-04-091-58/+64
|