Commit graph

50 commits

Author SHA1 Message Date
Charlie Marsh
ba9e7c9607 Allow trailing commas in MappingPattern 2023-02-22 10:02:41 -05:00
Jim Fasarakis-Hilliard
6e9c759cf7 Merge pull request #4519 from charliermarsh/charlie/match
Add support for match statements to parser
2023-02-21 19:43:28 +02:00
Jeong YunWon
304f6bc38e Merge pull request #4531 from charliermarsh/charlie/exception-groups
Implement except* syntax
2023-02-21 13:20:18 +09:00
Charlie Marsh
2a86dbd644 Implement except* syntax 2023-02-21 12:19:54 +09:00
Charlie Marsh
4c559a9a51 Allow starred expressions in subscripts 2023-02-20 17:59:35 -05:00
Charlie Marsh
8649bf6f8f Add support for match statements to parser 2023-02-20 15:03:39 -05:00
Jeong YunWon
24f4a0ed8f Merge pull request #4490 from DimitrisJim/function_parser
Add tests, some comments, to function.rs.
2023-02-13 20:00:35 +09:00
Dimitris Fasarakis Hilliard
7714c5f517 Add tests, some comments, to function.rs. 2023-02-11 23:07:57 +02:00
Dimitris Fasarakis Hilliard
e6f361d2a5 Refactor: Join string and string_parser. 2023-02-11 18:05:06 +02:00
Jeong YunWon
4ee4fcf407 Add test_generator_expression_argument 2023-02-11 05:20:39 +09:00
Jeong YunWon
1304e4ba2f Merge pull request #4449 from harupy/fix-dict-spread-in-dict
Fix AST generated from a dict literal containing dict unpacking
2023-01-22 20:44:26 +09:00
Anders Kaseorg
b93b23b922 Fix end location for elif blocks
Since we parse an `elif:` block as an `If` node, its location should
include its `orelse` node like it would for an `if:` block.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2023-01-17 22:39:44 -05:00
harupy
4f32bacf9c Rename test 2023-01-15 23:36:07 +09:00
harupy
a7f1904564 Improve test 2023-01-15 16:53:13 +09:00
harupy
52d2e25601 Fix dict spreading in dict literal 2023-01-15 13:01:59 +09:00
Dimitris Fasarakis Hilliard
bf715ab1ca Move tests for with into parser. 2023-01-01 21:36:07 +02:00
Jim Fasarakis-Hilliard
e4d2344c41 Merge pull request #4389 from harupy/4384-follow-up
Follow-up for #4384
2023-01-01 14:53:54 +02:00
harupy
95f3fa5a21 Fix NamedExpr location 2022-12-31 23:32:08 +09:00
harupy
6f8f655059 Move tests 2022-12-31 12:15:33 +09:00
harupy
faec9372f9 Fix FormattedValue location 2022-12-30 21:39:29 +09:00
Jeong YunWon
13699aacc1 Merge pull request #4358 from harupy/fix-slice-location
Fix `Slice` location
2022-12-26 16:03:09 +09:00
Jeong YunWon
d7986317c1 Merge pull request #4356 from andersk/with-tuple-named
Fix parsing of tuple with named expression as context manager
2022-12-26 16:02:17 +09:00
harupy
a5553aea43 Fix slice location 2022-12-25 09:37:07 +09:00
Anders Kaseorg
56da6c91b7 Fix parsing of tuple with named expression as context manager
Because the ‘with’ item grammar disallows named expressions, CPython
parses ‘with (a := 0, b := 1):’ as a tuple rather than two ‘with’
items.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-12-24 13:15:53 -08:00
harupy
6fc0d42d4a Fix IfExp location 2022-12-25 00:33:02 +09:00
harupy
2c61497074 Fix the location of BinOp 2022-12-21 22:05:05 +09:00
harupy
af7aac70df Fix locations of parethesized expressions 2022-12-18 20:53:30 +09:00
Dimitris Fasarakis Hilliard
f126b79b93 Fix end location in with statements. 2022-12-13 13:28:17 +02:00
Jim Fasarakis-Hilliard
ca1fe40701 Merge pull request #4327 from harupy/fix-end-location-body
Fix end location of compound statements
2022-12-13 12:30:21 +02:00
Charlie Marsh
36f5f5affb Set ExprContext::Store on parenthesized with expressions 2022-12-12 09:09:15 -05:00
harupy
f5ce9517fd Update snapshot 2022-12-12 22:26:03 +09:00
harupy
d6cd733423 Resolve conflict 2022-12-12 22:16:46 +09:00
Anders Kaseorg
bfd847d04c Parse Python 3.9+ parenthesized context managers
Since the upstream grammar for this is not LR(1), we abuse LALRPOP
macros and the Into/TryInto traits to build a cover grammar that
converts to either tuples or `with` items after additional validation.
It’s annoying and ugly, but something like this is basically our only
option short of switching to a more powerful parser algorithm.

Fixes #4145.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-12-12 00:47:33 -08:00
harupy
c79cc34b37 Fix other compound statements 2022-12-12 01:10:42 +09:00
harupy
2d75aeb276 Fix end location of nodes containing body 2022-12-11 12:35:28 +09:00
harupy
d45ac01ebe Fix 2022-12-10 18:45:36 +09:00
harupy
9111cd8a3d Fix plain string 2022-12-10 18:09:26 +09:00
harupy
dd01ab1c9e Fix the end location of an implicitly-concatenated string 2022-12-10 17:49:57 +09:00
harupy
8e0bef913c add tests 2022-12-04 05:59:51 +09:00
Charlie Marsh
ac1821b23d Set comparator start location to beginning of comparison 2022-11-07 12:24:14 -05:00
dvermd
1dfa2e5239 improve col_offset in new line and lalr 2022-10-26 21:30:51 +02:00
dvermd
ac77f7f501 Fix ast types' _fields and use 0-based column 2022-10-27 03:09:38 +09:00
Charlie Marsh
0cd0a0adc8 Add expression context parsing 2022-10-17 15:20:33 -04:00
Charlie Marsh
8a32bab00a Add end locations to all nodes (#4192) 2022-10-17 13:18:30 +09:00
Charlie Marsh
ca62bd1593 Start simple string at quote mark 2022-10-16 11:25:46 -04:00
Charlie Marsh
15e2ac3fd7 Start string location at kind or quote prefix 2022-10-15 11:03:50 -04:00
dvermd
eede189959 Refactor fstrings (#4188) 2022-10-14 12:16:34 +09:00
Charles Marsh
147187d18d Fix f-string regression 2022-08-21 19:20:23 -04:00
Charles Marsh
fa2e69983f Avoid creating unused JoinedStr in FStringParser 2022-08-21 16:59:36 -04:00
Jeong YunWon
060d153bb3 reorganize compiler crates 2022-08-22 04:42:42 +09:00