Skip to content

Commit f8dd778

Browse files
author
MattDMo
committed
addresses #52 and more
moved some things around to prioritize what got evaluated when (higher up overrides farther down) cleaned up some unused/unnecessary code
1 parent 1baf980 commit f8dd778

File tree

2 files changed

+181
-274
lines changed

2 files changed

+181
-274
lines changed

PythonImproved.YAML-tmLanguage

Lines changed: 47 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,24 @@ patterns:
101101
- name: keyword.operator.assignment.python
102102
match: \=
103103

104+
- include: '#builtin_types'
105+
106+
- include: '#builtin_functions_name'
107+
108+
- include: '#builtin_functions_call'
109+
110+
- include: '#errors_warnings_exceptions'
111+
112+
- include: '#docstrings'
113+
114+
- include: '#magic_function_calls'
115+
116+
- include: '#magic_function_names'
117+
118+
- include: '#magic_variable_names'
119+
120+
- include: '#generic_object_names'
121+
104122
- name: meta.class.old-style.python
105123
contentName: entity.name.type.class.python
106124
begin: \s*(class)\s+(?=[\p{Alpha}_][\p{Alnum}_]*\s*\:)
@@ -156,6 +174,35 @@ patterns:
156174
patterns:
157175
- include: '#entity_name_function'
158176

177+
- name: meta.function-call.python
178+
begin: (?:\.)?((self|cls)|([\p{Alpha}_][\p{Alnum}_]*))\s*(?=(\())
179+
beginCaptures:
180+
'2': {name: variable.parameter.function.language.python}
181+
'3': {name: meta.function-call.generic.python}
182+
'4': {name: punctuation.definition.arguments.begin.python}
183+
end: (\))
184+
endCaptures:
185+
'1': {name: punctuation.definition.arguments.end.python}
186+
patterns:
187+
- begin: (?=[\p{Alpha}_][\p{Alnum}_]*(?:\.[\p{Alpha}_][\p{Alnum}_]*)*\s*\()
188+
end: (?=\s*\()
189+
patterns:
190+
- include: '#dotted_name'
191+
- contentName: meta.function-call.arguments.python
192+
begin: (\()
193+
beginCaptures:
194+
'1': {name: punctuation.definition.arguments.begin.python}
195+
end: (?=(\)))
196+
endCaptures:
197+
'1': {name: punctuation.definition.arguments.end.python}
198+
patterns:
199+
- include: '#keyword_arguments'
200+
- include: $self
201+
- begin: \G
202+
end: (?=\()
203+
patterns:
204+
- include: '#dotted_name'
205+
159206
- name: meta.function.python
160207
begin: \s*((?:async\s+)?def)\s+(?=[\p{Alpha}_][\p{Alnum}_]*\s*\()
161208
beginCaptures:
@@ -278,66 +325,6 @@ patterns:
278325
patterns:
279326
- include: '#dotted_name'
280327

281-
- name: meta.function-call.python
282-
contentName: meta.function-call.arguments.python
283-
begin: (?<=\)|\])\s*(\()
284-
beginCaptures:
285-
'1': {name: punctuation.definition.arguments.begin.python}
286-
end: (\))
287-
endCaptures:
288-
'1': {name: punctuation.definition.arguments.end.python}
289-
patterns:
290-
- include: '#keyword_arguments'
291-
- include: $self
292-
293-
- include: '#builtin_types'
294-
295-
- include: '#builtin_functions_name'
296-
297-
- include: '#builtin_functions_call'
298-
299-
- include: '#errors_warnings_exceptions'
300-
301-
- include: '#docstrings'
302-
303-
- include: '#magic_function_names'
304-
305-
- include: '#magic_function_calls'
306-
307-
- include: '#magic_variable_names'
308-
309-
- include: '#language_variables'
310-
311-
- include: '#generic_object_names'
312-
313-
- name: meta.function-call.python
314-
begin: (?:\.)?([\p{Alpha}_][\p{Alnum}_]*)\s*(?=(\())
315-
beginCaptures:
316-
'1': {name: meta.function-call.generic.python}
317-
'2': {name: punctuation.definition.arguments.begin.python}
318-
end: (\))
319-
endCaptures:
320-
'1': {name: punctuation.definition.arguments.end.python}
321-
patterns:
322-
- begin: (?=[\p{Alpha}_][\p{Alnum}_]*(?:\.[\p{Alpha}_][\p{Alnum}_]*)*\s*\()
323-
end: (?=\s*\()
324-
patterns:
325-
- include: '#dotted_name'
326-
- contentName: meta.function-call.arguments.python
327-
begin: (\()
328-
beginCaptures:
329-
'1': {name: punctuation.definition.arguments.begin.python}
330-
end: (?=(\)))
331-
endCaptures:
332-
'1': {name: punctuation.definition.arguments.end.python}
333-
patterns:
334-
- include: '#keyword_arguments'
335-
- include: $self
336-
- begin: \G
337-
end: (?=\()
338-
patterns:
339-
- include: '#dotted_name'
340-
341328
- comment: Py2 print statement that should only be matched after function calls
342329
name: keyword.other.print.python
343330
match: (?<!\.)\b(print)(?=\s|$)
@@ -366,17 +353,6 @@ patterns:
366353
patterns:
367354
- include: '#dotted_name'
368355

369-
- name: meta.item-access.python
370-
contentName: meta.item-access.arguments.python
371-
begin: (?<=\)|\])\s*(\[)
372-
beginCaptures:
373-
'1': {name: punctuation.definition.arguments.begin.python}
374-
end: (\])
375-
endCaptures:
376-
'1': {name: punctuation.definition.arguments.end.python}
377-
patterns:
378-
- include: $self
379-
380356
- match: \b(class)\b
381357
captures:
382358
'1': {name: storage.type.class.python}

0 commit comments

Comments
 (0)