Skip to content

Commit f4e6afc

Browse files
committed
Stop highlighting single letter constants.
1 parent d608bea commit f4e6afc

File tree

7 files changed

+39
-15
lines changed

7 files changed

+39
-15
lines changed

grammars/MagicPython.cson

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ patterns: [
2929
]
3030
repository:
3131
impossible:
32-
comment: "This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a mathc to fail and move to the next token."
32+
comment: "This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a match to fail and move to the next token."
3333
match: "$.^"
3434
statement:
3535
patterns: [
@@ -435,7 +435,7 @@ repository:
435435
(?x)
436436
\\b
437437
(
438-
_* [[:upper:]]
438+
_* [[:upper:]]{2}
439439
)
440440
[[:upper:]\\d]* (_\\w*)?
441441
\\b

grammars/MagicPython.tmLanguage

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<key>impossible</key>
4646
<dict>
4747
<key>comment</key>
48-
<string>This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a mathc to fail and move to the next token.</string>
48+
<string>This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a match to fail and move to the next token.</string>
4949
<key>match</key>
5050
<string>$.^</string>
5151
</dict>
@@ -660,7 +660,7 @@
660660
<string>(?x)
661661
\b
662662
(
663-
_* [[:upper:]]
663+
_* [[:upper:]]{2}
664664
)
665665
[[:upper:]\d]* (_\w*)?
666666
\b

grammars/src/MagicPython.syntax.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ repository:
212212
is desired. It is not a good idea to match something like
213213
'1{0}' because in some cases that can result in infinite
214214
loops in token generation. So the rule instead matches
215-
and impossible expression to allow a mathc to fail and
215+
and impossible expression to allow a match to fail and
216216
move to the next token.
217217
match: '$.^'
218218

@@ -449,7 +449,7 @@ repository:
449449
(?x)
450450
\b
451451
(
452-
_* [[:upper:]]
452+
_* [[:upper:]]{2}
453453
)
454454
[[:upper:]\d]* (_\w*)?
455455
\b

test/calls/call1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
some_call : meta.function-call.generic.python, meta.function-call.python, source.python
66
( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python
7-
A : constant.other.caps.python, meta.function-call.arguments.python, meta.function-call.python, source.python
7+
A : meta.function-call.arguments.python, meta.function-call.python, source.python
88
, : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python
99
: meta.function-call.arguments.python, meta.function-call.python, source.python
1010
b : meta.function-call.arguments.python, meta.function-call.python, source.python

test/expressions/const1.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
QQQQ QQQQ_123 QQQQ123 PROTOCOL_v2 QQQ.bar baz.AA_a _AAA foo._AAA _A __A ___A
1+
QQQQ QQQQ_123 QQQQ123 PROTOCOL_v2 QQQ.bar baz.AA_a _AAA foo._AAA
22
QQQq QQQq123 self.FOOO() _ _1 __1 _1A __1A _a __a __ ___ ___a ___1 __aA ___Aa
33

44

@@ -24,12 +24,6 @@
2424
foo : source.python
2525
. : source.python
2626
_AAA : constant.other.caps.python, source.python
27-
: source.python
28-
_A : constant.other.caps.python, source.python
29-
: source.python
30-
__A : constant.other.caps.python, source.python
31-
: source.python
32-
___A : constant.other.caps.python, source.python
3327
QQQq : source.python
3428
: source.python
3529
QQQq123 : source.python

test/expressions/const2.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
_AA __AB ___AA
2+
_A __A ___A A1 A_1 _A_1 A_foo
3+
4+
5+
6+
_AA : constant.other.caps.python, source.python
7+
: source.python
8+
__AB : constant.other.caps.python, source.python
9+
: source.python
10+
___AA : constant.other.caps.python, source.python
11+
_A : source.python
12+
: source.python
13+
__A : source.python
14+
: source.python
15+
___A : source.python
16+
: source.python
17+
A1 : source.python
18+
: source.python
19+
A_1 : source.python
20+
: source.python
21+
_A_1 : source.python
22+
: source.python
23+
A_foo : source.python

test/unicode/unicode1.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class Üa(Êa):
44
def ŌÏŒĘ(self, Ú=1):
55
print('превед 你好')
66
return Ù
7+
ÜBER = 1
78
你好 = lambda: 你好
89
def 你好(): pass
910

@@ -48,7 +49,13 @@ def : meta.function.python, source.python, storage.type.function.pytho
4849
: source.python
4950
return : keyword.control.flow.python, source.python
5051
: source.python
51-
Ù : constant.other.caps.python, source.python
52+
Ù : source.python
53+
: source.python
54+
ÜBER : constant.other.caps.python, source.python
55+
: source.python
56+
= : keyword.operator.assignment.python, source.python
57+
: source.python
58+
1 : constant.numeric.dec.python, source.python
5259
: source.python
5360
你好 : source.python
5461
: source.python

0 commit comments

Comments
 (0)