Skip to content

Commit eb64fe3

Browse files
committed
Change the scope name for a generic ':'.
punctuation.separator.block.begin.python -> punctuation.separator.colon.python This makes it possible to not complicate the grammar to treat annotations differently.
1 parent a605599 commit eb64fe3

22 files changed

+58
-31
lines changed

grammars/MagicPython.cson

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ repository:
560560
punctuation:
561561
patterns: [
562562
{
563-
name: "punctuation.separator.block.begin.python"
563+
name: "punctuation.separator.colon.python"
564564
match: ":"
565565
}
566566
{

grammars/MagicPython.tmLanguage

+1-1
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@
874874
<array>
875875
<dict>
876876
<key>name</key>
877-
<string>punctuation.separator.block.begin.python</string>
877+
<string>punctuation.separator.colon.python</string>
878878
<key>match</key>
879879
<string>:</string>
880880
</dict>

grammars/src/MagicPython.syntax.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ repository:
536536

537537
punctuation:
538538
patterns:
539-
- name: punctuation.separator.block.begin.python
539+
- name: punctuation.separator.colon.python
540540
match: ":"
541541
- name: punctuation.separator.element.python
542542
match: ","

misc/scopes

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ 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
117+
punctuation.separator.colon.python
118118
punctuation.separator.continuation.line.python
119119
punctuation.separator.dict.python
120120
punctuation.separator.element.python

test/classes/class1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +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-
: : punctuation.separator.block.begin.python, source.python
12+
: : punctuation.separator.colon.python, source.python
1313
: source.python
1414
pass : keyword.control.flow.python, source.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-
: : punctuation.separator.block.begin.python, source.python
90+
: : punctuation.separator.colon.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

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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-
: : punctuation.separator.block.begin.python, source.python
15+
: : punctuation.separator.colon.python, source.python
1616
: source.python
1717
# : comment.line.number-sign.python, meta.typehint.comment.python, source.python
1818
type: : comment.line.number-sign.python, comment.typehint.directive.notation.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-
: : punctuation.separator.block.begin.python, source.python
70+
: : punctuation.separator.colon.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-
: : punctuation.separator.block.begin.python, source.python
108+
: : punctuation.separator.colon.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-
: : punctuation.separator.block.begin.python, source.python
69+
: : punctuation.separator.colon.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-
: : punctuation.separator.block.begin.python, source.python
107+
: : punctuation.separator.colon.python, source.python
108108
: source.python
109109
pass : keyword.control.flow.python, source.python

test/fstrings/nested1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ 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, punctuation.separator.block.begin.python, source.python
55+
: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.colon.python, source.python
5656
: meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
5757
pass : keyword.control.flow.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python
5858
} : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.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, punctuation.separator.block.begin.python, source.python
48+
: : meta.fstring.python, punctuation.separator.colon.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

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ 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, punctuation.separator.block.begin.python, source.python
24+
: : meta.fstring.python, punctuation.separator.colon.python, source.python
2525
: meta.fstring.python, source.python
2626
pass : keyword.control.flow.python, meta.fstring.python, source.python
2727
} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python

test/functions/async1.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def : meta.function.python, source.python, storage.type.function.pytho
3939
in : keyword.operator.logical.python, source.python
4040
: source.python
4141
b : source.python
42-
: : punctuation.separator.block.begin.python, source.python
42+
: : punctuation.separator.colon.python, source.python
4343
: source.python
4444
async : keyword.control.flow.python, source.python
4545
: source.python
@@ -53,7 +53,7 @@ def : meta.function.python, source.python, storage.type.function.pytho
5353
, : punctuation.separator.element.python, source.python
5454
: source.python
5555
c : source.python
56-
: : punctuation.separator.block.begin.python, source.python
56+
: : punctuation.separator.colon.python, source.python
5757
: source.python
5858
await : keyword.control.flow.python, source.python
5959
: 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-
: : punctuation.separator.block.begin.python, source.python
16+
: : punctuation.separator.colon.python, source.python
1717
: source.python
1818
pass : keyword.control.flow.python, source.python

test/functions/decl9.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +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-
: : punctuation.separator.block.begin.python, source.python
10+
: : punctuation.separator.colon.python, source.python
1111
: source.python
1212
pass : keyword.control.flow.python, source.python

test/functions/lambda8.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def foo(): pass
1717
d : source.python
1818
= : keyword.operator.assignment.python, source.python
1919
1 : constant.numeric.dec.python, source.python
20-
: : punctuation.separator.block.begin.python, source.python
20+
: : punctuation.separator.colon.python, source.python
2121
: source.python
2222
None : constant.language.python, source.python
2323
def : meta.function.python, source.python, storage.type.function.python

test/statements/annotation1.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
some_number: int # variable without initial value
2+
some_list: List[int] = [] # variable with initial value
3+
4+
5+
6+
some_number : source.python
7+
: : punctuation.separator.colon.python, source.python
8+
: source.python
9+
int : source.python, support.type.python
10+
: source.python
11+
# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python
12+
variable without initial value : comment.line.number-sign.python, source.python
13+
some_list : source.python
14+
: : punctuation.separator.colon.python, source.python
15+
: source.python
16+
List : meta.item-access.python, source.python
17+
[ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python
18+
int : meta.item-access.arguments.python, meta.item-access.python, source.python, support.type.python
19+
] : meta.item-access.python, punctuation.definition.arguments.end.python, source.python
20+
: source.python
21+
= : keyword.operator.assignment.python, source.python
22+
: source.python
23+
[ : punctuation.definition.list.begin.python, source.python
24+
] : punctuation.definition.list.end.python, source.python
25+
: source.python
26+
# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python
27+
variable with initial value : comment.line.number-sign.python, source.python

test/statements/for1.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
in : keyword.operator.logical.python, source.python
1919
: source.python
2020
b : source.python
21-
: : punctuation.separator.block.begin.python, source.python
21+
: : punctuation.separator.colon.python, source.python
2222
: source.python
2323
pass : keyword.control.flow.python, source.python
2424
else : keyword.control.flow.python, source.python
25-
: : punctuation.separator.block.begin.python, source.python
25+
: : punctuation.separator.colon.python, source.python
2626
: source.python
2727
1 : constant.numeric.dec.python, source.python
2828
/ : keyword.operator.arithmetic.python, source.python

test/statements/if1.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
: source.python
2121
c : source.python
2222
) : punctuation.parenthesis.end.python, source.python
23-
: : punctuation.separator.block.begin.python, source.python
23+
: : punctuation.separator.colon.python, source.python
2424
: source.python
2525
1 : constant.numeric.dec.python, source.python
2626
elif : keyword.control.flow.python, source.python
@@ -34,10 +34,10 @@
3434
and : keyword.operator.logical.python, source.python
3535
: source.python
3636
d : source.python
37-
: : punctuation.separator.block.begin.python, source.python
37+
: : punctuation.separator.colon.python, source.python
3838
: source.python
3939
2 : constant.numeric.dec.python, source.python
4040
else : keyword.control.flow.python, source.python
41-
: : punctuation.separator.block.begin.python, source.python
41+
: : punctuation.separator.colon.python, source.python
4242
: source.python
4343
3 : constant.numeric.dec.python, source.python

test/statements/try1.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
try : keyword.control.flow.python, source.python
15-
: : punctuation.separator.block.begin.python, source.python
15+
: : punctuation.separator.colon.python, source.python
1616
: source.python
1717
1 : constant.numeric.dec.python, source.python
1818
/ : keyword.operator.arithmetic.python, source.python
@@ -24,7 +24,7 @@
2424
as : keyword.control.flow.python, source.python
2525
: source.python
2626
ex : source.python
27-
: : punctuation.separator.block.begin.python, source.python
27+
: : punctuation.separator.colon.python, source.python
2828
: source.python
2929
pass : keyword.control.flow.python, source.python
3030
except : keyword.control.flow.python, source.python
@@ -39,17 +39,17 @@
3939
as : keyword.control.flow.python, source.python
4040
: source.python
4141
ex : source.python
42-
: : punctuation.separator.block.begin.python, source.python
42+
: : punctuation.separator.colon.python, source.python
4343
: source.python
4444
print : meta.function-call.python, source.python, support.function.builtin.python
4545
( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python
4646
ex : meta.function-call.arguments.python, meta.function-call.python, source.python
4747
) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python
4848
else : keyword.control.flow.python, source.python
49-
: : punctuation.separator.block.begin.python, source.python
49+
: : punctuation.separator.colon.python, source.python
5050
: source.python
5151
1 : constant.numeric.dec.python, source.python
5252
finally : keyword.control.flow.python, source.python
53-
: : punctuation.separator.block.begin.python, source.python
53+
: : punctuation.separator.colon.python, source.python
5454
: source.python
5555
2 : constant.numeric.dec.python, source.python

test/statements/while1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
while : keyword.control.flow.python, source.python
77
: source.python
88
1 : constant.numeric.dec.python, source.python
9-
: : punctuation.separator.block.begin.python, source.python
9+
: : punctuation.separator.colon.python, source.python
1010
: source.python
1111
pass : keyword.control.flow.python, source.python

test/statements/with1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
as : keyword.control.flow.python, source.python
1818
: source.python
1919
d : source.python
20-
: : punctuation.separator.block.begin.python, source.python
20+
: : punctuation.separator.colon.python, source.python
2121
: source.python
2222
pass : keyword.control.flow.python, source.python

0 commit comments

Comments
 (0)