Skip to content

Commit 7f6322c

Browse files
author
MattDMo
committed
Revert back to [\p{Alpha}_][\p{Alnum}_]* and so on...
1 parent a40c699 commit 7f6322c

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

PythonImproved.YAML-tmLanguage

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ patterns:
2525
- comment: Match identifiers in ALL_CAPS as constants, except when followed by . or
2626
(.
2727
name: constant.other.allcaps.python
28-
match: \b([\p{Upper}_][\p{Upper}\p{Nl}\p{Nd}\p{Pc}_]*)\b(?![\.\(])
28+
match: \b([\p{Upper}_][\p{Upper}\p{Digit}_]*)\b(?![\.\(])
2929

3030
- name: constant.numeric.integer.long.hexadecimal.python
3131
match: \b(?i:(0x\h+)L)
@@ -47,11 +47,11 @@ patterns:
4747

4848
- comment: Not quite perfect...
4949
name: constant.numeric.complex.python
50-
match: \b(?i:(((\d+(\.(?=[^\p{Letter}\p{Nl}_])\d*)?|(?<=[^\p{Alnum}_])\.\d+)(e[\-\+]?\d+)?))J)
50+
match: \b(?i:(((\d+(\.(?=[^\p{Alpha}_])\d*)?|(?<=[^\p{Alnum}_])\.\d+)(e[\-\+]?\d+)?))J)
5151

5252
- comment: Ummm... why do we have three of these? This is one...
5353
name: constant.numeric.float.python
54-
match: \b(?i:(\d+\.\d*(e[\-\+]?\d+)?))(?=[^\p{Letter}\p{Nl}_])
54+
match: \b(?i:(\d+\.\d*(e[\-\+]?\d+)?))(?=[^\p{Alpha}_])
5555

5656
- comment: This is two...
5757
name: constant.numeric.float.python
@@ -104,7 +104,7 @@ patterns:
104104

105105
- name: meta.class.old-style.python
106106
contentName: entity.name.type.class.python
107-
begin: \s*(class)\s+(?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*\s*\:)
107+
begin: \s*(class)\s+(?=[\p{Alpha}_][\p{Alnum}_]*\s*\:)
108108
beginCaptures:
109109
'1': {name: storage.type.class.python}
110110
end: \s*(:)
@@ -114,7 +114,7 @@ patterns:
114114
- include: '#entity_name_class'
115115

116116
- name: meta.class.python
117-
begin: \s*(class)\s+(?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*\s*\()
117+
begin: \s*(class)\s+(?=[\p{Alpha}_][\p{Alnum}_]*\s*\()
118118
beginCaptures:
119119
'1': {name: storage.type.class.python}
120120
end: (\))\s*(?:(\:)|(.*$\n?))
@@ -124,8 +124,8 @@ patterns:
124124
'3': {name: invalid.illegal.missing-section-begin.python}
125125
patterns:
126126
- contentName: entity.name.type.class.python
127-
begin: (?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
128-
end: (?![[\p{Word}\p{Nl}]&&[^\p{Me}]])
127+
begin: (?=[\p{Alpha}_][\p{Alnum}_]*)
128+
end: (?![\p{Alnum}_])
129129
patterns:
130130
- include: '#entity_name_class'
131131
- contentName: meta.class.inheritance.python
@@ -143,7 +143,7 @@ patterns:
143143
- include: $self
144144

145145
- name: meta.class.python
146-
begin: \s*(class)\s+(?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]])
146+
begin: \s*(class)\s+(?=[\p{Alpha}_][\p{Alnum}_])
147147
beginCaptures:
148148
'1': {name: storage.type.class.python}
149149
end: (\()|\s*($\n?|#.*$\n?)
@@ -158,15 +158,15 @@ patterns:
158158
- include: '#entity_name_function'
159159

160160
- name: meta.function.python
161-
begin: \s*((?:async\s+)?def)\s+(?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*\s*\()
161+
begin: \s*((?:async\s+)?def)\s+(?=[\p{Alpha}_][\p{Alnum}_]*\s*\()
162162
beginCaptures:
163163
'1': {name: storage.type.function.python}
164164
end: (\:)
165165
endCaptures:
166166
'1': {name: punctuation.section.function.begin.python}
167167
patterns:
168168
- contentName: entity.name.function.python
169-
begin: (?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
169+
begin: (?=[\p{Alpha}_][\p{Alnum}_]*)
170170
end: (?![A-Za-z0-9_])
171171
patterns:
172172
- include: '#entity_name_function'
@@ -179,7 +179,7 @@ patterns:
179179
- include: '#annotated_arguments'
180180
- include: '#keyword_arguments'
181181
- include: '#comments'
182-
- match: \b(?:(self|cls)|([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*))\s*(?:(,)|(?=[\n\)]))
182+
- match: \b(?:(self|cls)|([\p{Alpha}_][\p{Alnum}_]*))\s*(?:(,)|(?=[\n\)]))
183183
captures:
184184
'1': {name: variable.parameter.function.language.python}
185185
'2': {name: variable.parameter.function.python}
@@ -193,7 +193,7 @@ patterns:
193193
- include: $self
194194

195195
- name: meta.function.python
196-
begin: \s*((?:async\s+)?def)\s+(?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
196+
begin: \s*((?:async\s+)?def)\s+(?=[\p{Alpha}_][\p{Alnum}_]*)
197197
beginCaptures:
198198
'1': {name: storage.type.function.python}
199199
end: (\()|\s*($\n?|#.*$\n?)
@@ -202,8 +202,8 @@ patterns:
202202
'2': {name: invalid.illegal.missing-parameters.python}
203203
patterns:
204204
- contentName: entity.name.function.python
205-
begin: (?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
206-
end: (?![[\p{Word}\p{Nl}]&&[^\p{Me}]])
205+
begin: (?=[\p{Alpha}_][\p{Alnum}_]*)
206+
end: (?![\p{Alnum}_])
207207
patterns:
208208
- include: '#entity_name_function'
209209

@@ -237,20 +237,20 @@ patterns:
237237
end: (?=\:)
238238
patterns:
239239
- include: '#keyword_arguments'
240-
- match: \b([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)\s*(?:(,)|(?=[\n\)\:]))
240+
- match: \b([\p{Alpha}_][\p{Alnum}_]*)\s*(?:(,)|(?=[\n\)\:]))
241241
captures:
242242
'1': {name: variable.parameter.function.python}
243243
'2': {name: punctuation.separator.parameters.python}
244244

245245
- comment: a decorator may be a function call which returns a decorator.
246246
name: meta.function.decorator.python
247-
begin: ^\s*(?=@\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(?:\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*\s*\()
247+
begin: ^\s*(?=@\s*[\p{Alpha}_][\p{Alnum}_]*(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*\s*\()
248248
end: (?<=\))
249249
endCaptures:
250250
'1': {name: punctuation.definition.arguments.end.python}
251251
patterns:
252252
- contentName: entity.name.function.decorator.python
253-
begin: (?=(@)\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(?:\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*\s*\()
253+
begin: (?=(@)\s*[\p{Alpha}_][\p{Alnum}_]*(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*\s*\()
254254
beginCaptures:
255255
'1': {name: punctuation.definition.decorator.python}
256256
end: (?=\s*\()
@@ -269,10 +269,10 @@ patterns:
269269

270270
- name: meta.function.decorator.python
271271
contentName: entity.name.function.decorator.python
272-
begin: ^\s*(?=@\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(?:\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*)
272+
begin: ^\s*(?=@\s*[\p{Alpha}_][\p{Alnum}_]*(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*)
273273
end: (?=\s|$\n?|#)
274274
patterns:
275-
- begin: (?=(@)\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*)
275+
- begin: (?=(@)\s*[\p{Alpha}_][\p{Alnum}_]*(\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*)
276276
beginCaptures:
277277
'1': {name: punctuation.definition.decorator.python}
278278
end: (?=\s|$\n?|#)
@@ -312,15 +312,15 @@ patterns:
312312
- include: '#generic_object_names'
313313

314314
- name: meta.function-call.python
315-
begin: (?:\.)?([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)\s*(?=(\())
315+
begin: (?:\.)?([\p{Alpha}_][\p{Alnum}_]*)\s*(?=(\())
316316
beginCaptures:
317317
'1': {name: meta.function-call.generic.python}
318318
'2': {name: punctuation.definition.arguments.begin.python}
319319
end: (\))
320320
endCaptures:
321321
'1': {name: punctuation.definition.arguments.end.python}
322322
patterns:
323-
- begin: (?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(?:\.[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*\s*\()
323+
- begin: (?=[\p{Alpha}_][\p{Alnum}_]*(?:\.[\p{Alpha}_][\p{Alnum}_]*)*\s*\()
324324
end: (?=\s*\()
325325
patterns:
326326
- include: '#dotted_name'
@@ -344,12 +344,12 @@ patterns:
344344
match: (?<!\.)\b(print)(?=\s|$)
345345

346346
- name: meta.item-access.python
347-
begin: (?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(?:\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*\s*\[)
347+
begin: (?=[\p{Alpha}_][\p{Alnum}_]*(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*\s*\[)
348348
end: (\])
349349
endCaptures:
350350
'1': {name: punctuation.definition.arguments.end.python}
351351
patterns:
352-
- begin: (?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(?:\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*\s*\[)
352+
- begin: (?=[\p{Alpha}_][\p{Alnum}_]*(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*\s*\[)
353353
end: (?=\s*\[)
354354
patterns:
355355
- include: '#dotted_name'
@@ -458,7 +458,7 @@ patterns:
458458

459459
repository:
460460
annotated_arguments:
461-
begin: \b([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)\s*(:)|(?=\()
461+
begin: \b([\p{Alpha}_][\p{Alnum}_]*)\s*(:)|(?=\()
462462
beginCaptures:
463463
'1': {name: variable.parameter.function.python}
464464
'2': {name: punctuation.separator.annotation.python}
@@ -479,7 +479,7 @@ repository:
479479
endCaptures:
480480
'1': {name: punctuation.definition.parameters-group.end.python}
481481
patterns:
482-
- begin: \b([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)\s*(:)
482+
- begin: \b([\p{Alpha}_][\p{Alnum}_]*)\s*(:)
483483
beginCaptures:
484484
'1': {name: variable.parameter.function.python}
485485
'2': {name: punctuation.separator.annotation.python}
@@ -488,7 +488,7 @@ repository:
488488
'1': {name: punctuation.separator.parameters.python}
489489
patterns:
490490
- include: $self
491-
- begin: \b([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
491+
- begin: \b([\p{Alpha}_][\p{Alnum}_]*)
492492
beginCaptures:
493493
'1': {name: variable.parameter.function.python}
494494
end: \s*(?:(,)|(?=$\n?|\)))
@@ -521,7 +521,7 @@ repository:
521521
endCaptures:
522522
'1': {name: punctuation.definition.arguments.end.python}
523523
patterns:
524-
- begin: (?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(?:\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*\s*\()
524+
- begin: (?=[\p{Alpha}_][\p{Alnum}_]*(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*\s*\()
525525
end: (?=\s*\()
526526
patterns:
527527
- include: '#dotted_name'
@@ -623,23 +623,23 @@ repository:
623623
begin: |-
624624
(?x)(?=
625625
(?:\.(?!\s+import)\s*)?
626-
[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*
627-
(?:\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*
626+
[\p{Alpha}_][\p{Alnum}_]*
627+
(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*
628628
)
629629
end: (?![\p{Alnum}_\.\s])|(?=(?<!\.)\s+[^.])|$
630630
patterns:
631-
- begin: (\.)(?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
631+
- begin: (\.)(?=[\p{Alpha}_][\p{Alnum}_]*)
632632
beginCaptures:
633633
'1': {name: meta.dot.python}
634-
end: (?![[\p{Word}\p{Nl}]&&[^\p{Me}]])
634+
end: (?![\p{Alnum}_])
635635
patterns:
636636
- include: '#builtin_functions_name'
637637
- include: '#magic_function_names'
638638
- include: '#magic_variable_names'
639639
- include: '#generic_names'
640640
- include: '#illegal_names'
641-
- begin: (?<!\.)(?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
642-
end: (?![[\p{Word}\p{Nl}]&&[^\p{Me}]])
641+
- begin: (?<!\.)(?=[\p{Alpha}_][\p{Alnum}_]*)
642+
end: (?![\p{Alnum}_])
643643
patterns:
644644
- include: '#builtin_types'
645645
- include: '#builtin_functions_name'
@@ -678,18 +678,18 @@ repository:
678678
Memory | Name | NotImplemented | OS | Overflow | Reference | Runtime |
679679
Recursion | Standard | Syntax | System | Tab | Type | UnboundLocal |
680680
Unicode(Encode | Decode | Translate)? | Value | VMS | Windows |
681-
ZeroDivision | ([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*))
681+
ZeroDivision | ([\p{Alpha}_][\p{Alnum}_]*))
682682
?Error
683683
|
684684
(
685685
(Pending)?Deprecation | Bytes | Future | Import | Resource |
686-
Runtime | Syntax | Unicode | User | [\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
686+
Runtime | Syntax | Unicode | User | [\p{Alpha}_][\p{Alnum}_]*)
687687
?Warning
688688
|
689689
SystemExit | Stop(Async)?Iteration | NotImplemented |
690690
KeyboardInterrupt | GeneratorExit
691691
|
692-
([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)
692+
([\p{Alpha}_][\p{Alnum}_]*)
693693
?Exception
694694
)
695695
\b
@@ -734,10 +734,10 @@ repository:
734734

735735
generic_names:
736736
name: meta.identifier.python
737-
match: '[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*'
737+
match: '[\p{Alpha}_][\p{Alnum}_]*'
738738

739739
generic_object_names:
740-
match: (\.\b([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)\b(?!\(|\[)|\b([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)\b\.)
740+
match: (\.\b([\p{Alpha}_][\p{Alnum}_]*)\b(?!\(|\[)|\b([\p{Alpha}_][\p{Alnum}_]*)\b\.)
741741

742742
illegal_names:
743743
comment: 'from Lib/keyword.py, in kwlist. `async` and `await` not keywords
@@ -753,7 +753,7 @@ repository:
753753
\b
754754
755755
keyword_arguments:
756-
begin: \b([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)\s*(=)(?!=)
756+
begin: \b([\p{Alpha}_][\p{Alnum}_]*)\s*(=)(?!=)
757757
beginCaptures:
758758
'1': {name: variable.parameter.function.keyword.python}
759759
'2': {name: keyword.operator.assignment.python}
@@ -836,7 +836,7 @@ repository:
836836
endCaptures:
837837
'1': {name: punctuation.definition.arguments.end.python}
838838
patterns:
839-
- begin: (?=[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*(?:\s*\.\s*[\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)*\s*\()
839+
- begin: (?=[\p{Alpha}_][\p{Alnum}_]*(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*\s*\()
840840
end: (?=\s*\()
841841
patterns:
842842
- include: '#dotted_name'
@@ -880,7 +880,7 @@ repository:
880880
(
881881
(?<argname>
882882
(
883-
(?<identifier>([\p{Letter}\p{Nl}_][[\p{Word}\p{Nl}]&&[^\p{Me}]]*)) |
883+
(?<identifier>([\p{Alpha}_][\p{Alnum}_]*)) |
884884
(?<integer>
885885
([1-9]\d* | 0) |
886886
(

0 commit comments

Comments
 (0)