Skip to content

Commit 8a81abe

Browse files
Added interior scopes to python (#2814)
ci fails because of: nodejs/corepack#612 ## Release notes You can now use `"inside"` in Python loops and conditionals (`if`, `for`/`while`, `try`, etc).
1 parent 6c12bc3 commit 8a81abe

14 files changed

+355
-35
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
if True:
2+
a
3+
elif False:
4+
b
5+
else:
6+
c
7+
---
8+
9+
[#1 Content] =
10+
[#1 Removal] = 1:4-1:5
11+
>-<
12+
1| a
13+
14+
[#1 Domain] = 0:0-1:5
15+
>--------
16+
0| if True:
17+
1| a
18+
-----<
19+
20+
[#1 Insertion delimiter] = " "
21+
22+
23+
[#2 Content] =
24+
[#2 Removal] = 3:4-3:5
25+
>-<
26+
3| b
27+
28+
[#2 Domain] = 2:0-3:5
29+
>-----------
30+
2| elif False:
31+
3| b
32+
-----<
33+
34+
[#2 Insertion delimiter] = " "
35+
36+
37+
[#3 Content] =
38+
[#3 Removal] = 5:4-5:5
39+
>-<
40+
5| c
41+
42+
[#3 Domain] = 4:0-5:5
43+
>-----
44+
4| else:
45+
5| c
46+
-----<
47+
48+
[#3 Insertion delimiter] = " "
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
for v in values:
2+
pass
3+
---
4+
5+
[Content] =
6+
[Removal] = 1:4-1:8
7+
>----<
8+
1| pass
9+
10+
[Domain] = 0:0-1:8
11+
>----------------
12+
0| for v in values:
13+
1| pass
14+
--------<
15+
16+
[Insertion delimiter] = " "
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
while True:
2+
pass
3+
---
4+
5+
[Content] =
6+
[Removal] = 1:4-1:8
7+
>----<
8+
1| pass
9+
10+
[Domain] = 0:0-1:8
11+
>-----------
12+
0| while True:
13+
1| pass
14+
--------<
15+
16+
[Insertion delimiter] = " "
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
match value:
2+
case 1:
3+
a
4+
case _:
5+
b
6+
---
7+
8+
[#1 Content] = 1:4-4:9
9+
>-------
10+
1| case 1:
11+
2| a
12+
3| case _:
13+
4| b
14+
---------<
15+
16+
[#1 Removal] = 0:12-4:9
17+
>
18+
0| match value:
19+
1| case 1:
20+
2| a
21+
3| case _:
22+
4| b
23+
---------<
24+
25+
[#1 Domain] = 0:0-4:9
26+
>------------
27+
0| match value:
28+
1| case 1:
29+
2| a
30+
3| case _:
31+
4| b
32+
---------<
33+
34+
[#1 Insertion delimiter] = " "
35+
36+
37+
[#2 Content] =
38+
[#2 Removal] = 2:8-2:9
39+
>-<
40+
2| a
41+
42+
[#2 Domain] = 1:4-2:9
43+
>-------
44+
1| case 1:
45+
2| a
46+
---------<
47+
48+
[#2 Insertion delimiter] = " "
49+
50+
51+
[#3 Content] =
52+
[#3 Removal] = 4:8-4:9
53+
>-<
54+
4| b
55+
56+
[#3 Domain] = 3:4-4:9
57+
>-------
58+
3| case _:
59+
4| b
60+
---------<
61+
62+
[#3 Insertion delimiter] = " "
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
1 if True else 0
2+
---
3+
4+
[#1 Content] =
5+
[#1 Removal] =
6+
[#1 Domain] = 0:0-0:1
7+
>-<
8+
0| 1 if True else 0
9+
10+
[#1 Insertion delimiter] = " "
11+
12+
13+
[#2 Content] =
14+
[#2 Removal] = 0:5-0:9
15+
>----<
16+
0| 1 if True else 0
17+
18+
[#2 Domain] = 0:2-0:9
19+
>-------<
20+
0| 1 if True else 0
21+
22+
[#2 Insertion delimiter] = " "
23+
24+
25+
[#3 Content] =
26+
[#3 Removal] = 0:15-0:16
27+
>-<
28+
0| 1 if True else 0
29+
30+
[#3 Domain] = 0:10-0:16
31+
>------<
32+
0| 1 if True else 0
33+
34+
[#3 Insertion delimiter] = " "
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
try:
2+
a
3+
except:
4+
b
5+
finally:
6+
c
7+
---
8+
9+
[#1 Content] =
10+
[#1 Removal] = 1:4-1:5
11+
>-<
12+
1| a
13+
14+
[#1 Domain] = 0:0-1:5
15+
>----
16+
0| try:
17+
1| a
18+
-----<
19+
20+
[#1 Insertion delimiter] = " "
21+
22+
23+
[#2 Content] =
24+
[#2 Removal] = 3:4-3:5
25+
>-<
26+
3| b
27+
28+
[#2 Domain] = 2:0-3:5
29+
>-------
30+
2| except:
31+
3| b
32+
-----<
33+
34+
[#2 Insertion delimiter] = " "
35+
36+
37+
[#3 Content] =
38+
[#3 Removal] = 5:4-5:5
39+
>-<
40+
5| c
41+
42+
[#3 Domain] = 4:0-5:5
43+
>--------
44+
4| finally:
45+
5| c
46+
-----<
47+
48+
[#3 Insertion delimiter] = " "
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
try:
2+
a
3+
except*:
4+
b
5+
---
6+
7+
[#1 Content] =
8+
[#1 Removal] = 1:4-1:5
9+
>-<
10+
1| a
11+
12+
[#1 Domain] = 0:0-1:5
13+
>----
14+
0| try:
15+
1| a
16+
-----<
17+
18+
[#1 Insertion delimiter] = " "
19+
20+
21+
[#2 Content] =
22+
[#2 Removal] = 3:4-3:5
23+
>-<
24+
3| b
25+
26+
[#2 Domain] = 2:0-3:5
27+
>--------
28+
2| except*:
29+
3| b
30+
-----<
31+
32+
[#2 Insertion delimiter] = " "
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
with file:
2+
pass
3+
---
4+
5+
[Content] =
6+
[Removal] = 1:4-1:8
7+
>----<
8+
1| pass
9+
10+
[Domain] = 0:0-1:8
11+
>----------
12+
0| with file:
13+
1| pass
14+
--------<
15+
16+
[Insertion delimiter] = " "

packages/common/src/scopeSupportFacets/lua.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ export const luaScopeSupport: LanguageScopeSupportFacetMap = {
1616
namedFunction: supported,
1717
disqualifyDelimiter: supported,
1818
"interior.function": supported,
19-
"interior.branch": supported,
19+
"interior.if": supported,
2020
};

0 commit comments

Comments
 (0)