Skip to content

Commit 1ddcf80

Browse files
author
MattDMo
committed
rolled up all the changes
1 parent 49fa349 commit 1ddcf80

File tree

3 files changed

+483
-126
lines changed

3 files changed

+483
-126
lines changed

PythonImproved-Unicode.YAML-tmLanguage

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ name: PythonImproved-Unicode
55
scopeName: source.python
66
fileTypes: [py, py3, rpy, pyw, cpy, SConstruct, Sconstruct, sconstruct, SConscript]
77
uuid: 11B0273F-0284-4483-B17B-4B8D0A9294CC
8-
# uuid: A4AB2A88-CBF6-4515-84B7-396046E21286
98

109
patterns:
1110
- name: support.ipython.in.python
@@ -78,7 +77,7 @@ patterns:
7877
name: keyword.operator.logical.python
7978
match: \b(and|in|is|not|or)\b
8079

81-
- comment: keywords that don't fit into other groups.
80+
- comment: keywords that do not fit into other groups.
8281
name: keyword.other.python
8382
match: \b(assert|del)\b
8483

@@ -209,21 +208,16 @@ patterns:
209208
captures:
210209
'1': {name: storage.type.function.python}
211210

212-
-
213-
comment: |
214-
Keywords that delimit flow blocks or alter flow from within a
215-
block.
216-
217-
This block should be matched *after* meta.function.python to
218-
let 'async def' be matched *first*.
219-
211+
- comment: 'Keywords that delimit flow blocks or alter flow from within a
212+
block. This block should be matched *after* meta.function.python to
213+
let `async def` be matched *first*.'
220214
name: keyword.control.flow.python
221-
match: |
222-
(?x) \b(
223-
async | await | break | continue | elif | else | except | finally |
224-
for | if | pass | raise | return | try | while | with |
225-
(yield(?:\s+from)?)
226-
)\b
215+
match: |-
216+
(?x) \b(
217+
async | await | break | continue | elif | else | except | finally |
218+
for | if | pass | raise | return | try | while | with |
219+
(yield(?:\s+from)?)
220+
)\b
227221
228222
- name: meta.function.inline.python
229223
begin: (lambda)(?=\s+|:)
@@ -306,6 +300,8 @@ patterns:
306300

307301
- include: '#magic_function_names'
308302

303+
- include: '#magic_function_calls'
304+
309305
- include: '#magic_variable_names'
310306

311307
- include: '#language_variables'
@@ -500,7 +496,7 @@ repository:
500496
builtin_functions_call:
501497
patterns:
502498
- name: meta.function-call.python
503-
begin: |
499+
begin: |-
504500
(?x)
505501
(?<!\.)\b(
506502
__import__ | abs | all | any | ascii | basestring | bin | bool |
@@ -514,7 +510,7 @@ repository:
514510
reversed | round | set | setattr | slice | sorted | staticmethod |
515511
str | sum | super | tuple | type | unichr | unicode | vars |
516512
xrange | zip)
517-
\b\s*(?=\()
513+
\b\s*(?=(\())
518514
beginCaptures:
519515
'1': {name: support.function.builtin.python}
520516
'2': {name: punctuation.definition.arguments.begin.python}
@@ -526,18 +522,20 @@ repository:
526522
end: (?=\s*\()
527523
patterns:
528524
- include: '#dotted_name'
529-
- begin: (\()
525+
- contentName: meta.function-call.arguments.python
526+
begin: (\()
530527
beginCaptures:
531528
'1': {name: punctuation.definition.arguments.begin.python}
532-
contentName: meta.function-call.arguments.python
533529
end: (?=\))
530+
endCaptures:
531+
'0': {name: punctuation.definition.arguments.end.python}
534532
patterns:
535533
- include: '#keyword_arguments'
536534
- include: $self
537535

538536
builtin_functions_name:
539-
- name: support.function.builtin.python
540-
match: |
537+
name: support.function.builtin.python
538+
match: |-
541539
(?x)
542540
(?<!\.)
543541
\b(
@@ -556,9 +554,9 @@ repository:
556554
557555
builtin_types:
558556
name: support.type.python
559-
comment: These are from https://docs.python.org/X/library/functions.html
560-
where X is 2.7 or 3.5 and the item is a class. Also stdtypes.html
561-
match: |
557+
comment: 'These are from https://docs.python.org/X/library/functions.html
558+
where X is 2.7 or 3.5 and the item is a class. Also stdtypes.html'
559+
match: |-
562560
(?x)
563561
(?<!\.)
564562
\b(
@@ -619,20 +617,20 @@ repository:
619617
- include: '#string_quoted_single'
620618

621619
dotted_name:
622-
begin: |
620+
begin: |-
623621
(?x)(?=
624622
(?:\.(?!\s+import)\s*)?
625623
[\p{Alpha}_][\p{Alnum}_]*
626624
(?:\s*\.\s*[\p{Alpha}_][\p{Alnum}_]*)*
627625
)
628626
end: (?![\p{Alnum}_\.\s])|(?=(?<!\.)\s+[^.])|$
629-
# contentName: meta.dotted-name.python
630627
patterns:
631628
- begin: (\.)(?=[\p{Alpha}_][\p{Alnum}_]*)
632629
beginCaptures:
633630
'1': {name: meta.dot.python}
634631
end: (?![\p{Alnum}_])
635632
patterns:
633+
- include: '#builtin_functions_name'
636634
- include: '#magic_function_names'
637635
- include: '#magic_variable_names'
638636
- include: '#generic_names'
@@ -645,6 +643,7 @@ repository:
645643
- include: '#builtin_types'
646644
- include: '#errors_warnings_exceptions'
647645
- include: '#magic_function_names'
646+
- include: '#magic_function_calls'
648647
- include: '#magic_variable_names'
649648
- include: '#language_variables'
650649
- include: '#generic_names'
@@ -664,7 +663,7 @@ repository:
664663

665664
errors_warnings_exceptions:
666665
name: support.type.exception.python
667-
match: |
666+
match: |-
668667
(?x)
669668
\b(
670669
(
@@ -693,7 +692,7 @@ repository:
693692
\b
694693
695694
escaped_char:
696-
match: |
695+
match: |-
697696
(?x)
698697
(\\x[\h]{2}) |
699698
(\\[0-7]{3}) |
@@ -712,7 +711,7 @@ repository:
712711
'1': {name: constant.character.escape.hex.python}
713712
'2': {name: constant.character.escape.octal.python}
714713
'3': {name: constant.character.escape.newline.python}
715-
'4': {name: constant.character.escape.backlash.python}
714+
'4': {name: constant.character.escape.backslash.python}
716715
'5': {name: constant.character.escape.double-quote.python}
717716
'6': {name: constant.character.escape.single-quote.python}
718717
'7': {name: constant.character.escape.bell.python}
@@ -726,8 +725,8 @@ repository:
726725
escaped_unicode_char:
727726
match: (\\U[\h]{8})|(\\u[\h]{4})|(\\N\{[a-zA-Z0-9\, ]+\})
728727
captures:
729-
'1': {name: constant.character.escape.unicode.16-bit-hex.python}
730-
'2': {name: constant.character.escape.unicode.32-bit-hex.python}
728+
'1': {name: constant.character.escape.unicode.32-bit-hex.python}
729+
'2': {name: constant.character.escape.unicode.16-bit-hex.python}
731730
'3': {name: constant.character.escape.unicode.name.python}
732731

733732
generic_names:
@@ -738,10 +737,10 @@ repository:
738737
match: (\.\b([\p{Alpha}_][\p{Alnum}_]*)\b(?!\(|\[)|\b([\p{Alpha}_][\p{Alnum}_]*)\b\.)
739738

740739
illegal_names:
741-
comment: from Lib/keyword.py, in kwlist. `async` and `await` not keywords
742-
until Python 3.7 (according to PEP-0492)
740+
comment: 'from Lib/keyword.py, in kwlist. `async` and `await` not keywords
741+
until Python 3.7 (according to PEP-0492)'
743742
name: invalid.illegal.name.python
744-
match: |
743+
match: |-
745744
(?x)
746745
\b (
747746
False | None | True | and | as | assert | break | class | continue | def |
@@ -755,7 +754,6 @@ repository:
755754
beginCaptures:
756755
'1': {name: variable.parameter.function.keyword.python}
757756
'2': {name: keyword.operator.assignment.python}
758-
# Change #2 to something else?
759757
end: \s*(?:(,)|(?=$\n?|[\)\:]))
760758
endCaptures:
761759
'1': {name: punctuation.separator.parameters.python}
@@ -772,11 +770,11 @@ repository:
772770
'1': {name: punctuation.separator.continuation.line.python}
773771

774772
magic_function_names:
775-
comment: these methods have magic interpretation by python and are generally
773+
comment: 'these methods have magic interpretation by python and are generally
776774
called indirectly through syntactic constructs. Names are from
777775
https://docs.python.org/X/reference/datamodel.html where X is 2.7 and 3.5
778-
See also http://www.rafekettler.com/magicmethods.html
779-
match: |
776+
See also http://www.rafekettler.com/magicmethods.html'
777+
match: |-
780778
(?x)
781779
(\.)?
782780
\b (
@@ -801,11 +799,14 @@ repository:
801799
\b
802800
captures:
803801
'2': {name: support.function.magic.python}
802+
803+
magic_function_calls:
804804
patterns:
805805
- name: meta.function-call.python
806-
begin: |
806+
begin: |-
807807
(?x)
808-
(?<!\.)\b(
808+
(\.)?
809+
\b(
809810
__(?:
810811
abs | add | aenter | aexit | aiter | and | anext | await | bool |
811812
bytes | call | ceil | cmp | coerce | complex | contains | copy |
@@ -824,10 +825,10 @@ repository:
824825
setstate | sizeof | str | sub | subclasscheck | truediv | trunc |
825826
unicode | xor)
826827
__)
827-
\s*(?=\()
828+
\s*(?=(\())
828829
beginCaptures:
829-
'1': {name: support.function.magic.python}
830-
'2': {name: punctuation.definition.arguments.begin.python}
830+
'2': {name: support.function.magic.python}
831+
'4': {name: punctuation.definition.arguments.begin.python}
831832
end: (\))
832833
endCaptures:
833834
'1': {name: punctuation.definition.arguments.end.python}
@@ -836,18 +837,20 @@ repository:
836837
end: (?=\s*\()
837838
patterns:
838839
- include: '#dotted_name'
839-
- begin: (\()
840+
- contentName: meta.function-call.arguments.python
841+
begin: (\()
840842
beginCaptures:
841843
'1': {name: punctuation.definition.arguments.begin.python}
842-
contentName: meta.function-call.arguments.python
843844
end: (?=\))
845+
endCaptures:
846+
'0': {name: punctuation.definition.arguments.end.python}
844847
patterns:
845848
- include: '#keyword_arguments'
846849
- include: $self
847850

848851
magic_variable_names:
849852
comment: magic attributes which a class/module may have.
850-
match: |
853+
match: |-
851854
(?x)
852855
(\.)?
853856
\b(
@@ -862,7 +865,8 @@ repository:
862865

863866
regular_expressions:
864867
patterns:
865-
- include: source.regexp.python
868+
- include: source.regex.python
869+
comment: source.regexp.python is the default, this is the PI version
866870

867871
string_quoted_double:
868872
patterns:
@@ -1231,7 +1235,6 @@ repository:
12311235
- include: '#string_quoted_single'
12321236

12331237
author: Matt Morrison @MattDMo [email protected]
1234-
# bundleUUID: 0F24FCF1-6543-4CC6-8B33-2EAED401FE3A
12351238
bundleUUID: EB590797-FBEE-4BEA-A140-8339AFD2CE1B
12361239
firstLineMatch: ^#!/.*\bpython[0-9.-]*\b
12371240
foldingStartMarker: ^\s*(((?:async\s+)?def)|class)\s+([.\p{Alnum}_ <]+)\s*(\((.*)\))?\s*:|\{\s*$|\(\s*$|\[\s*$|^\s*"""(?=.)(?!.*""")

0 commit comments

Comments
 (0)