Skip to content

Commit c16e08d

Browse files
authored
Merge pull request #4340 from harupy/fix-locations-of-parethesized-expressions
Fix the start and end locations of `Tuple`
2 parents f4672e4 + ff00460 commit c16e08d

13 files changed

Lines changed: 41 additions & 41 deletions

‎parser/python.lalrpop‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ AtomAs<Goal>: Goal = {
10891089
node: ast::ExprKind::ListComp { elt: Box::new(elt), generators }
10901090
}.into()
10911091
},
1092-
"(" <location:@L> <items:OneOrMore<TestOrStarNamedExprOrWithitem>> <trailing_comma:","?> <end_location:@R> ")" =>? {
1092+
<location:@L> "(" <items:OneOrMore<TestOrStarNamedExprOrWithitem>> <trailing_comma:","?> ")" <end_location:@R> =>? {
10931093
if items.len() == 1 && items[0].1.is_none() && trailing_comma.is_none() {
10941094
match items[0].0.node {
10951095
ast::ExprKind::Starred { .. } => {

‎parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ expression: parse_ast
5555
value: Located {
5656
location: Location {
5757
row: 1,
58-
column: 7,
58+
column: 6,
5959
},
6060
end_location: Some(
6161
Location {
6262
row: 1,
63-
column: 14,
63+
column: 15,
6464
},
6565
),
6666
custom: (),

‎parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ expression: parse_ast
3636
iter: Located {
3737
location: Location {
3838
row: 1,
39-
column: 10,
39+
column: 9,
4040
},
4141
end_location: Some(
4242
Location {
4343
row: 1,
44-
column: 17,
44+
column: 18,
4545
},
4646
),
4747
custom: (),

‎parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ expression: parse_ast
7373
value: Located {
7474
location: Location {
7575
row: 1,
76-
column: 10,
76+
column: 9,
7777
},
7878
end_location: Some(
7979
Location {
8080
row: 1,
81-
column: 17,
81+
column: 18,
8282
},
8383
),
8484
custom: (),

‎parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ expression: parse_ast
8787
iter: Located {
8888
location: Location {
8989
row: 1,
90-
column: 17,
90+
column: 16,
9191
},
9292
end_location: Some(
9393
Location {
9494
row: 1,
95-
column: 24,
95+
column: 25,
9696
},
9797
),
9898
custom: (),

‎parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ expression: parse_ast
3838
value: Located {
3939
location: Location {
4040
row: 1,
41-
column: 5,
41+
column: 4,
4242
},
4343
end_location: Some(
4444
Location {
4545
row: 1,
46-
column: 12,
46+
column: 13,
4747
},
4848
),
4949
custom: (),

‎parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ expression: parse_ast
8787
iter: Located {
8888
location: Location {
8989
row: 1,
90-
column: 17,
90+
column: 16,
9191
},
9292
end_location: Some(
9393
Location {
9494
row: 1,
95-
column: 24,
95+
column: 25,
9696
},
9797
),
9898
custom: (),

‎parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ expression: parse_ast
2020
Located {
2121
location: Location {
2222
row: 1,
23-
column: 1,
23+
column: 0,
2424
},
2525
end_location: Some(
2626
Location {
2727
row: 1,
28-
column: 6,
28+
column: 7,
2929
},
3030
),
3131
custom: (),
@@ -89,12 +89,12 @@ expression: parse_ast
8989
value: Located {
9090
location: Location {
9191
row: 1,
92-
column: 11,
92+
column: 10,
9393
},
9494
end_location: Some(
9595
Location {
9696
row: 1,
97-
column: 18,
97+
column: 19,
9898
},
9999
),
100100
custom: (),

‎parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ expression: parse_ast
7171
value: Located {
7272
location: Location {
7373
row: 1,
74-
column: 8,
74+
column: 7,
7575
},
7676
end_location: Some(
7777
Location {
7878
row: 1,
79-
column: 15,
79+
column: 16,
8080
},
8181
),
8282
custom: (),

‎parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ expression: parse_ast
2020
Located {
2121
location: Location {
2222
row: 1,
23-
column: 1,
23+
column: 0,
2424
},
2525
end_location: Some(
2626
Location {
2727
row: 1,
28-
column: 5,
28+
column: 6,
2929
},
3030
),
3131
custom: (),
@@ -73,12 +73,12 @@ expression: parse_ast
7373
value: Located {
7474
location: Location {
7575
row: 1,
76-
column: 10,
76+
column: 9,
7777
},
7878
end_location: Some(
7979
Location {
8080
row: 1,
81-
column: 17,
81+
column: 18,
8282
},
8383
),
8484
custom: (),

0 commit comments

Comments
 (0)