Skip to content

Commit c9a3e41

Browse files
committed
Add scopes for ':'.
punctuation.separator.block.begin.python punctuation.separator.dict.python punctuation.separator.slice.python
1 parent a28fd72 commit c9a3e41

33 files changed

+122
-43
lines changed

grammars/MagicPython.cson

+18
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ repository:
349349
{
350350
include: "#ellipsis"
351351
}
352+
{
353+
include: "#punctuation"
354+
}
352355
{
353356
include: "#line-continuation"
354357
}
@@ -444,6 +447,10 @@ repository:
444447
"0":
445448
name: "punctuation.definition.dict.end.python"
446449
patterns: [
450+
{
451+
name: "punctuation.separator.dict.python"
452+
match: ":"
453+
}
447454
{
448455
include: "#expression"
449456
}
@@ -550,6 +557,13 @@ repository:
550557
name: "keyword.operator.arithmetic.python"
551558
"5":
552559
name: "keyword.operator.comparison.python"
560+
punctuation:
561+
patterns: [
562+
{
563+
name: "punctuation.separator.block.begin.python"
564+
match: ":"
565+
}
566+
]
553567
literal:
554568
patterns: [
555569
{
@@ -1428,6 +1442,10 @@ repository:
14281442
name: "punctuation.definition.arguments.begin.python"
14291443
contentName: "meta.item-access.arguments.python"
14301444
patterns: [
1445+
{
1446+
name: "punctuation.separator.slice.python"
1447+
match: ":"
1448+
}
14311449
{
14321450
include: "#expression"
14331451
}

grammars/MagicPython.tmLanguage

+28
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@
536536
<key>include</key>
537537
<string>#ellipsis</string>
538538
</dict>
539+
<dict>
540+
<key>include</key>
541+
<string>#punctuation</string>
542+
</dict>
539543
<dict>
540544
<key>include</key>
541545
<string>#line-continuation</string>
@@ -678,6 +682,12 @@
678682
</dict>
679683
<key>patterns</key>
680684
<array>
685+
<dict>
686+
<key>name</key>
687+
<string>punctuation.separator.dict.python</string>
688+
<key>match</key>
689+
<string>:</string>
690+
</dict>
681691
<dict>
682692
<key>include</key>
683693
<string>#expression</string>
@@ -858,6 +868,18 @@
858868
</dict>
859869
</dict>
860870
</dict>
871+
<key>punctuation</key>
872+
<dict>
873+
<key>patterns</key>
874+
<array>
875+
<dict>
876+
<key>name</key>
877+
<string>punctuation.separator.block.begin.python</string>
878+
<key>match</key>
879+
<string>:</string>
880+
</dict>
881+
</array>
882+
</dict>
861883
<key>literal</key>
862884
<dict>
863885
<key>patterns</key>
@@ -2251,6 +2273,12 @@
22512273
<string>meta.item-access.arguments.python</string>
22522274
<key>patterns</key>
22532275
<array>
2276+
<dict>
2277+
<key>name</key>
2278+
<string>punctuation.separator.slice.python</string>
2279+
<key>match</key>
2280+
<string>:</string>
2281+
</dict>
22542282
<dict>
22552283
<key>include</key>
22562284
<string>#expression</string>

grammars/src/MagicPython.syntax.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ repository:
392392
- include: '#illegal-names'
393393
- include: '#special-variables'
394394
- include: '#ellipsis'
395+
- include: '#punctuation'
395396
- include: '#line-continuation'
396397

397398
expression-base:
@@ -452,6 +453,8 @@ repository:
452453
endCaptures:
453454
'0': {name: punctuation.definition.dict.end.python}
454455
patterns:
456+
- name: punctuation.separator.dict.python
457+
match: ":"
455458
- include: '#expression'
456459

457460
list:
@@ -531,6 +534,11 @@ repository:
531534
'4': {name: keyword.operator.arithmetic.python}
532535
'5': {name: keyword.operator.comparison.python}
533536

537+
punctuation:
538+
patterns:
539+
- name: punctuation.separator.block.begin.python
540+
match: ":"
541+
534542
literal:
535543
patterns:
536544
- name: constant.language.python
@@ -1079,6 +1087,8 @@ repository:
10791087
'1': {name: punctuation.definition.arguments.begin.python}
10801088
contentName: meta.item-access.arguments.python
10811089
patterns:
1090+
- name: punctuation.separator.slice.python
1091+
match: ":"
10821092
- include: '#expression'
10831093

10841094
decorator:

misc/scopes

+3
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,12 @@ punctuation.section.function.lambda.begin.python
114114
punctuation.separator.annotation.python
115115
punctuation.separator.annotation.result.python
116116
punctuation.separator.arguments.python
117+
punctuation.separator.block.begin.python
117118
punctuation.separator.continuation.line.python
119+
punctuation.separator.dict.python
118120
punctuation.separator.inheritance.python
119121
punctuation.separator.parameters.python
122+
punctuation.separator.slice.python
120123
storage.modifier.declaration.python
121124
storage.modifier.flag.regexp
122125
storage.type.class.python

test/calls/call1.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
' : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python
2929
q : meta.function-call.arguments.python, meta.function-call.python, source.python, string.quoted.single.python
3030
' : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.end.python, source.python, string.quoted.single.python
31-
: : meta.function-call.arguments.python, meta.function-call.python, source.python
31+
: : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.dict.python, source.python
32+
: meta.function-call.arguments.python, meta.function-call.python, source.python
3233
42 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python
3334
} : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.dict.end.python, source.python
3435
, : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python

test/classes/class1.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ class : source.python, storage.type.class.python
99
-> : invalid.illegal.annotation.python, source.python
1010
: source.python
1111
None : constant.language.python, source.python
12-
: : source.python
12+
: : punctuation.separator.block.begin.python, source.python
13+
: source.python
1314
pass : keyword.control.flow.python, source.python

test/classes/class2.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class : meta.class.python, source.python, storage.type.class.python
2323
' : meta.class.inheritance.python, meta.class.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python
2424
very : meta.class.inheritance.python, meta.class.python, source.python, string.quoted.single.python
2525
' : meta.class.inheritance.python, meta.class.python, punctuation.definition.string.end.python, source.python, string.quoted.single.python
26-
: : meta.class.inheritance.python, meta.class.python, source.python
26+
: : meta.class.inheritance.python, meta.class.python, punctuation.separator.dict.python, source.python
27+
: meta.class.inheritance.python, meta.class.python, source.python
2728
' : meta.class.inheritance.python, meta.class.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python
2829
odd : meta.class.inheritance.python, meta.class.python, source.python, string.quoted.single.python
2930
' : meta.class.inheritance.python, meta.class.python, punctuation.definition.string.end.python, source.python, string.quoted.single.python

test/classes/super1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def : meta.function.python, source.python, storage.type.function.pytho
8787
) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python
8888
: source.python
8989
if : keyword.control.flow.python, source.python
90-
: : source.python
90+
: : punctuation.separator.block.begin.python, source.python
9191
: source.python
9292
__init__ : meta.function-call.python, source.python, support.function.magic.python
9393
( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python

test/comments/typing5.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
: meta.function-call.arguments.python, meta.function-call.python, source.python
1313
TypeVar : meta.function-call.arguments.python, meta.function-call.python, source.python
1414
) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python
15-
: : source.python
15+
: : punctuation.separator.block.begin.python, source.python
16+
: source.python
1617
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
1718
type: : comment.line.number-sign.python, comment.typehint.directive.notation.python, meta.typehint.comment.python, source.python
1819
: comment.line.number-sign.python, meta.typehint.comment.python, source.python

test/docstrings/mix1.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def : meta.function.python, source.python, storage.type.function.pytho
6767
with : keyword.control.flow.python, source.python
6868
: source.python
6969
bar : source.python
70-
: : source.python
70+
: : punctuation.separator.block.begin.python, source.python
7171
: source.python
7272
pass : keyword.control.flow.python, source.python
7373
: source.python
@@ -105,6 +105,6 @@ def : meta.function.python, source.python, storage.type.function.pytho
105105
with : keyword.control.flow.python, source.python
106106
: source.python
107107
bar : source.python
108-
: : source.python
108+
: : punctuation.separator.block.begin.python, source.python
109109
: source.python
110110
pass : keyword.control.flow.python, source.python

test/docstrings/mix2.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def : meta.function.python, source.python, storage.type.function.pytho
6666
with : keyword.control.flow.python, source.python
6767
: source.python
6868
bar : source.python
69-
: : source.python
69+
: : punctuation.separator.block.begin.python, source.python
7070
: source.python
7171
pass : keyword.control.flow.python, source.python
7272
: source.python
@@ -104,6 +104,6 @@ def : meta.function.python, source.python, storage.type.function.pytho
104104
with : keyword.control.flow.python, source.python
105105
: source.python
106106
bar : source.python
107-
: : source.python
107+
: : punctuation.separator.block.begin.python, source.python
108108
: source.python
109109
pass : keyword.control.flow.python, source.python

test/expressions/expr11.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
some_list : meta.item-access.python, source.python
1212
[ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python
1313
1 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, source.python
14-
: : meta.item-access.arguments.python, meta.item-access.python, source.python
14+
: : meta.item-access.arguments.python, meta.item-access.python, punctuation.separator.slice.python, source.python
1515
2 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, source.python
1616
] : meta.item-access.python, punctuation.definition.arguments.end.python, source.python

test/expressions/expr5.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
: source.python
2929
{ : punctuation.definition.dict.begin.python, source.python
3030
from : keyword.control.flow.python, source.python
31-
: : source.python
31+
: : punctuation.separator.dict.python, source.python
32+
: source.python
3233
{ : punctuation.definition.dict.begin.python, source.python
3334
import : keyword.control.flow.python, source.python
34-
: : source.python
35+
: : punctuation.separator.dict.python, source.python
36+
: source.python
3537
a : source.python
3638
} : punctuation.definition.dict.end.python, source.python
3739
} : punctuation.definition.dict.end.python, source.python

test/expressions/expr6.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
, : source.python
1919
{ : punctuation.definition.dict.begin.python, source.python
2020
c : source.python
21-
: : source.python
21+
: : punctuation.separator.dict.python, source.python
22+
: source.python
2223
d : meta.function-call.generic.python, meta.function-call.python, source.python
2324
( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python
2425
b : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python
@@ -27,7 +28,8 @@
2728
) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python
2829
, : source.python
2930
e : source.python
30-
: : source.python
31+
: : punctuation.separator.dict.python, source.python
32+
: source.python
3133
[ : punctuation.definition.list.begin.python, source.python
3234
a : source.python
3335
, : source.python

test/fstrings/comment4.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
: meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
2121
{ : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.dict.begin.python, source.python
2222
4 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
23-
: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
23+
: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.dict.python, source.python
2424
5 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
2525
} : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.dict.end.python, source.python
2626
: meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python

test/fstrings/nested1.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def : keyword.control.flow.python, meta.fstring.python, meta.function-
5252
aaa : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.generic.python, meta.function-call.python, source.python
5353
( : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.arguments.begin.python, source.python
5454
) : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.arguments.end.python, source.python
55-
: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
55+
: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.block.begin.python, source.python
56+
: meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
5657
pass : keyword.control.flow.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
5758
} : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
5859
111 : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.interpolated.python, string.quoted.single.python

test/fstrings/simple1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
[ : meta.fstring.python, punctuation.definition.list.begin.python, source.python
4646
: meta.fstring.python, source.python
4747
] : meta.fstring.python, punctuation.definition.list.end.python, source.python
48-
: : meta.fstring.python, source.python
48+
: : meta.fstring.python, punctuation.separator.block.begin.python, source.python
4949
Xd : meta.fstring.python, source.python
5050
> : keyword.operator.comparison.python, meta.fstring.python, source.python
5151
+ : keyword.operator.arithmetic.python, meta.fstring.python, source.python

test/fstrings/simple6.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def : keyword.control.flow.python, meta.fstring.python, source.python
2121
aaa : meta.fstring.python, meta.function-call.generic.python, meta.function-call.python, source.python
2222
( : meta.fstring.python, meta.function-call.python, punctuation.definition.arguments.begin.python, source.python
2323
) : meta.fstring.python, meta.function-call.python, punctuation.definition.arguments.end.python, source.python
24-
: : meta.fstring.python, source.python
24+
: : meta.fstring.python, punctuation.separator.block.begin.python, source.python
25+
: meta.fstring.python, source.python
2526
pass : keyword.control.flow.python, meta.fstring.python, source.python
2627
} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python
2728
' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.single.python

test/functions/async1.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def : meta.function.python, source.python, storage.type.function.pytho
3737
in : keyword.operator.logical.python, source.python
3838
: source.python
3939
b : source.python
40-
: : source.python
40+
: : punctuation.separator.block.begin.python, source.python
4141
: source.python
4242
async : keyword.control.flow.python, source.python
4343
: source.python
@@ -50,7 +50,7 @@ def : meta.function.python, source.python, storage.type.function.pytho
5050
d : source.python
5151
, : source.python
5252
c : source.python
53-
: : source.python
53+
: : punctuation.separator.block.begin.python, source.python
5454
: source.python
5555
await : keyword.control.flow.python, source.python
5656
: source.python

test/functions/decl13.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ def : meta.function.python, source.python, storage.type.function.pytho
1313
-> : invalid.illegal.annotation.python, source.python
1414
: source.python
1515
notOK : source.python
16-
: : source.python
16+
: : punctuation.separator.block.begin.python, source.python
1717
: source.python
1818
pass : keyword.control.flow.python, source.python

test/functions/decl4.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def : meta.function.python, source.python, storage.type.function.pytho
2727
: meta.function.parameters.python, meta.function.python, source.python
2828
{ : meta.function.parameters.python, meta.function.python, punctuation.definition.dict.begin.python, source.python
2929
key : meta.function.parameters.python, meta.function.python, source.python
30-
: : meta.function.parameters.python, meta.function.python, source.python
30+
: : meta.function.parameters.python, meta.function.python, punctuation.separator.dict.python, source.python
31+
: meta.function.parameters.python, meta.function.python, source.python
3132
val : meta.function.parameters.python, meta.function.python, source.python
3233
: meta.function.parameters.python, meta.function.python, source.python
3334
for : keyword.control.flow.python, meta.function.parameters.python, meta.function.python, source.python

test/functions/decl9.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
foo : meta.function-call.generic.python, meta.function-call.python, source.python
88
( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python
99
) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python
10-
: : source.python
10+
: : punctuation.separator.block.begin.python, source.python
11+
: source.python
1112
pass : keyword.control.flow.python, source.python

0 commit comments

Comments
 (0)