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

Lines changed: 18 additions & 0 deletions
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

Lines changed: 28 additions & 0 deletions
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

Lines changed: 10 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

0 commit comments

Comments
 (0)