@@ -65,115 +65,288 @@ comments:
6565scopes :
6666 ' module' : ' source.python'
6767
68- ' comment' : ' comment.line'
69- ' string' : ' string.quoted'
70- ' escape_sequence' : ' constant.character.escape'
71- ' interpolation' : ' meta.embedded'
72- ' interpolation > "{"' : ' punctuation.section.embedded'
73- ' interpolation > "}"' : ' punctuation.section.embedded'
68+ # Keyword
69+ ' "if"' : ' keyword.control.condition'
70+ ' "else"' : ' keyword.control.condition'
71+ ' "elif"' : ' keyword.control.condition'
72+ ' "while"' : ' keyword.control.loop'
73+ ' "for"' : ' keyword.control.loop'
74+ ' "return"' : ' keyword.control.jump'
75+ ' "break"' : ' keyword.control.jump'
76+ ' "continue"' : ' keyword.control.jump'
77+ ' "pass"' : ' keyword.control.jump'
78+ ' "yield"' : ' keyword.control.jump'
79+ ' "raise"' : ' keyword.control.jump'
80+ ' "await"' : ' keyword.control.jump'
81+ ' "try"' : ' keyword.control.exception'
82+ ' "except"' : ' keyword.control.exception'
83+ ' "finally"' : ' keyword.control.exception'
84+ ' "import"' : ' keyword.control.package'
85+ ' "from"' : ' keyword.control.package'
86+ ' "with"' : ' keyword.control.evaluate'
87+ ' "as"' : ' keyword.control.evaluate'
88+ ' "assert"' : ' keyword.control.evaluate'
89+
90+ ' "print"' : ' keyword.control.print'
91+ ' "exec"' : ' keyword.control.exec'
92+
93+ ' "+"' : ' keyword.operator.symbol'
94+ ' "-"' : ' keyword.operator.symbol'
95+ ' "*"' : ' keyword.operator.symbol'
96+ ' "/"' : ' keyword.operator.symbol'
97+ ' "%"' : ' keyword.operator.symbol'
98+ ' "**"' : ' keyword.operator.symbol'
99+ ' "//"' : ' keyword.operator.symbol'
100+ ' "=="' : ' keyword.operator.symbol'
101+ ' "!="' : ' keyword.operator.symbol'
102+ ' "<>"' : ' keyword.operator.symbol'
103+ ' ">"' : ' keyword.operator.symbol'
104+ ' "<"' : ' keyword.operator.symbol'
105+ ' ">="' : ' keyword.operator.symbol'
106+ ' "<="' : ' keyword.operator.symbol'
107+ ' "="' : ' keyword.operator.symbol'
108+ ' ":="' : ' keyword.operator.symbol'
109+ ' "+="' : ' keyword.operator.symbol'
110+ ' "-="' : ' keyword.operator.symbol'
111+ ' "*="' : ' keyword.operator.symbol'
112+ ' "/="' : ' keyword.operator.symbol'
113+ ' "%="' : ' keyword.operator.symbol'
114+ ' "**="' : ' keyword.operator.symbol'
115+ ' "//="' : ' keyword.operator.symbol'
116+ ' "&"' : ' keyword.operator.symbol'
117+ ' "|"' : ' keyword.operator.symbol'
118+ ' "^"' : ' keyword.operator.symbol'
119+ ' "~"' : ' keyword.operator.symbol'
120+ ' "<<"' : ' keyword.operator.symbol'
121+ ' ">>"' : ' keyword.operator.symbol'
122+ ' binary_operator > "@"' : ' keyword.operator.symbol'
123+ ' binary_operator > "@="' : ' keyword.operator.symbol'
124+ ' "in"' : ' keyword.operator.comparison'
125+ ' "is"' : ' keyword.operator.comparison'
126+ ' "and"' : ' keyword.operator.logical'
127+ ' "or"' : ' keyword.operator.logical'
128+ ' "not"' : ' keyword.operator.logical'
129+ ' "del"' : ' keyword.operator.delete'
130+
131+ # Storage
132+ ' "global"' : ' storage.modifier.global'
133+ ' "nonlocal"' : ' storage.modifier.nonlocal'
134+ ' "async"' : ' storage.modifier.async'
135+
136+ ' "def"' : ' storage.declaration.function'
137+ ' "lambda"' : ' storage.declaration.function'
138+ ' "class"' : ' storage.declaration.datatype.class'
139+
140+ '''
141+ type > identifier,
142+ type > subscript > identifier
143+ ''' : [
144+ {
145+ match : ' ^(bool|bytearray|bytes|complex|dict|float|frozenset|int|list|memoryview|object|range|set|str|tuple)$' ,
146+ scopes : ' storage.type.language'
147+ },
148+ ' storage.type.entity'
149+ ]
150+
151+ # Entity
152+ '''
153+ identifier,
154+ class_definition > argument_list > identifier,
155+ class_definition > argument_list > keyword_argument > identifier:nth-child(2)
156+ ''' : [
157+ {
158+ exact : ' cls' ,
159+ scopes : ' entity.variable.support.cls'
160+ },
161+ {
162+ exact : ' self' ,
163+ scopes : ' entity.variable.support.self'
164+ }
165+ ]
166+
167+ '''
168+ parameters > identifier,
169+ parameters > list_splat > identifier,
170+ parameters > dictionary_splat > identifier,
171+ default_parameter > identifier:nth-child(0),
172+ keyword_argument > identifier:nth-child(0)
173+ ''' : [
174+ {
175+ exact : ' cls' ,
176+ scopes : ' entity.variable.support.parameter.cls'
177+ },
178+ {
179+ exact : ' self' ,
180+ scopes : ' entity.variable.support.parameter.self'
181+ },
182+ ' entity.variable.parameter'
183+ ]
184+
185+ ' identifier' : [
186+ {
187+ match : ' ^(BaseException|Exception|TypeError|StopAsyncIteration|StopIteration|ImportError|ModuleNotFoundError|OSError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|BlockingIOError|ChildProcessError|FileExistsError|FileNotFoundError|IsADirectoryError|NotADirectoryError|InterruptedError|PermissionError|ProcessLookupError|TimeoutError|EOFError|RuntimeError|RecursionError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|LookupError|IndexError|KeyError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|AssertionError|ArithmeticError|FloatingPointError|OverflowError|ZeroDivisionError|SystemError|ReferenceError|BufferError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning|BytesWarning|ResourceWarning|GeneratorExit|SystemExit|KeyboardInterrupt)$' ,
188+ scopes : ' entity.type.class.exception.support'
189+ },
190+ {
191+ match : ' ^(bool|bytearray|bytes|complex|dict|float|frozenset|int|list|memoryview|object|range|set|str|tuple)$' ,
192+ scopes : ' entity.type.language'
193+ },
194+ ' entity.variable'
195+ ]
196+
197+ '''
198+ class_definition > argument_list > identifier,
199+ class_definition > argument_list > keyword_argument > identifier:nth-child(2)
200+ ''' : {
201+ match : ' ^(BaseException|Exception|TypeError|StopAsyncIteration|StopIteration|ImportError|ModuleNotFoundError|OSError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|BlockingIOError|ChildProcessError|FileExistsError|FileNotFoundError|IsADirectoryError|NotADirectoryError|InterruptedError|PermissionError|ProcessLookupError|TimeoutError|EOFError|RuntimeError|RecursionError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|LookupError|IndexError|KeyError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|AssertionError|ArithmeticError|FloatingPointError|OverflowError|ZeroDivisionError|SystemError|ReferenceError|BufferError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning|BytesWarning|ResourceWarning|GeneratorExit|SystemExit|KeyboardInterrupt)$' ,
202+ scopes : ' entity.type.class.exception.inherited.support'
203+ }
74204
75- ' class_definition > identifier' : ' entity.name.type.class'
76- ' function_definition > identifier' : ' entity.name.function'
77205 ' call > identifier:nth-child(0)' : [
78- {match : ' ^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$' ,
79- scopes : ' support.function' },
80- ' entity.name.function'
81- ]
82- ' call > attribute > identifier:nth-child(2)' : ' entity.name.function'
206+ {
207+ match : ' ^(bool|bytearray|bytes|complex|dict|float|frozenset|int|list|memoryview|object|range|set|str|tuple)$' ,
208+ scopes : ' entity.type.constructor.language.call'
209+ },
210+ {
211+ exact : ' super' ,
212+ scopes : ' entity.function.support.call.super'
213+ },
214+ {
215+ match : ' ^(abs|all|any|ascii|bin|breakpoint|callable|chr|classmethod|compile|delattr|dir|divmod|enumerate|eval|exec|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|min|next|oct|open|ord|pow|print|property|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|type|vars|zip|__import__)$' ,
216+ scopes : ' entity.function.support.call'
217+ },
218+ ' entity.function.call'
219+ ]
220+
221+ ' decorator > dotted_name > identifier' : [
222+ {
223+ match : ' ^(classmethod|property|staticmethod)$' ,
224+ scopes : ' entity.function.decorator.support'
225+ },
226+ ' entity.decorator'
227+ ]
83228
84- ' identifier' :
85- {match :
86- ' ^(BaseException|Exception|TypeError|StopAsyncIteration|StopIteration|ImportError|ModuleNotFoundError|OSError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|BlockingIOError|ChildProcessError|FileExistsError|FileNotFoundError|IsADirectoryError|NotADirectoryError|InterruptedError|PermissionError|ProcessLookupError|TimeoutError|EOFError|RuntimeError|RecursionError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|LookupError|IndexError|KeyError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|AssertionError|ArithmeticError|FloatingPointError|OverflowError|ZeroDivisionError|SystemError|ReferenceError|BufferError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning|BytesWarning|ResourceWarning|GeneratorExit|SystemExit|KeyboardInterrupt)$'
87- scopes : ' support.type.exception' }
229+ ' call > attribute > identifier:nth-child(2)' : ' entity.function.method.call'
88230
89- ' attribute > identifier:nth-child(2) ' : ' variable.other.object.property '
231+ ' function_definition > identifier' : ' entity.function.definition '
90232
91- ' decorator' : ' entity.name.function.decorator'
233+ ' attribute > identifier:nth-child(2)' : ' entity.variable.member'
234+
235+ ' class_definition > identifier' : ' entity.type.class.definition'
236+
237+ '''
238+ class_definition > argument_list > identifier,
239+ class_definition > argument_list > attribute > identifier:nth-child(2),
240+ class_definition > argument_list > keyword_argument > identifier:nth-child(2),
241+ class_definition > argument_list > keyword_argument > attribute > identifier:nth-child(2)
242+ ''' : ' entity.type.class.inherited'
243+
244+ # String
245+ ' string' : ' string.quoted'
246+ ' format_specifier' : ' string.format'
247+ ' interpolation' : ' string.interpolation'
248+
249+ # Constant
250+ ' escape_sequence' : [
251+ {
252+ match : ' [tf]' ,
253+ scopes : ' constant.character.escape.whitespace'
254+ },
255+ {
256+ match : ' [nr]' ,
257+ scopes : ' constant.character.escape.whitespace.newline'
258+ },
259+ ' constant.character.escape'
260+ ]
92261
93- ' none' : ' constant.language'
94- ' true' : ' constant.language'
95- ' false' : ' constant.language'
96262 ' integer' : ' constant.numeric'
97263 ' float' : ' constant.numeric'
98264
99- ' type > identifier' : ' support.storage.type'
265+ ' none' : ' constant.language.null'
266+ ' true' : ' constant.language.boolean'
267+ ' false' : ' constant.language.boolean'
268+ ' ellipsis' : ' constant.language.ellipsis.symbol'
100269
101- ' class_definition > argument_list > attribute' : ' entity.other.inherited-class'
102- ' class_definition > argument_list > identifier' : ' entity.other.inherited-class'
103- ' class_definition > argument_list > keyword_argument > attribute' : ' entity.other.inherited-class'
104- ' class_definition > argument_list > keyword_argument > identifier:nth-child(2)' : ' entity.other.inherited-class'
270+ # Comment
271+ ' comment' : ' comment.line'
105272
106- ' "class"' : ' storage.type.class'
107- ' "def"' : ' storage.type.function'
108- ' "lambda"' : ' storage.type.function'
273+ # Punctuation
274+ ' "."' : ' punctuation.accessor'
275+ ' ","' : ' punctuation.separator'
276+ ' ";"' : ' punctuation.terminator'
277+ ' ":"' : ' punctuation.definition'
278+ ' "("' : ' punctuation.definition'
279+ ' ")"' : ' punctuation.definition'
280+ ' "{"' : ' punctuation.definition'
281+ ' "}"' : ' punctuation.definition'
282+ ' "["' : ' punctuation.definition'
283+ ' "]"' : ' punctuation.definition'
284+ ' "\\ ""' : ' punctuation.definition.string'
109285
110- ' "global"' : ' storage.modifier.global'
111- ' "nonlocal"' : ' storage.modifier.nonlocal'
286+ ' import_prefix > "."' : ' punctuation.definition.import.relative'
287+
288+ ' typed_default_parameter > ":"' : ' punctuation.definition.type'
289+ ' assignment > ":"' : ' punctuation.definition.type'
290+ ' typed_parameters > ":"' : ' punctuation.definition.type'
291+ ' "->"' : ' punctuation.definition.type.return'
292+
293+ ' slice > ":"' : ' punctuation.separator.slice'
294+ ' pair > ":"' : ' punctuation.separator.pair'
295+
296+ ' decorator > "@"' : ' punctuation.definition.decorator'
297+
298+ ' future_import_statement > "("' : ' punctuation.definition.package'
299+ ' future_import_statement > ")"' : ' punctuation.definition.package'
300+ ' import_from_statement > "("' : ' punctuation.definition.package'
301+ ' import_from_statement > ")"' : ' punctuation.definition.package'
302+
303+ ' parameters > "("' : ' punctuation.definition.parameters'
304+ ' parameters > ")"' : ' punctuation.definition.parameters'
305+
306+ ' argument_list > "("' : ' punctuation.definition.arguments'
307+ ' argument_list > ")"' : ' punctuation.definition.arguments'
308+
309+ ' parenthesized_expression > "("' : ' punctuation.definition.expression'
310+ ' parenthesized_expression > ")"' : ' punctuation.definition.expression'
311+ ' generator_expression > "("' : ' punctuation.definition.generator'
312+ ' generator_expression > ")"' : ' punctuation.definition.generator'
313+
314+ ' tuple > "("' : ' punctuation.definition.tuple'
315+ ' tuple > ")"' : ' punctuation.definition.tuple'
316+
317+ ' subscript > "["' : ' punctuation.accessor'
318+ ' subscript > "]"' : ' punctuation.accessor'
319+
320+ ' list > "["' : ' punctuation.definition.list'
321+ ' list > "]"' : ' punctuation.definition.list'
322+ ' list_comprehension > "["' : ' punctuation.definition.list'
323+ ' list_comprehension > "]"' : ' punctuation.definition.list'
324+
325+ ' dictionary > "{"' : ' punctuation.definition.dictionary'
326+ ' dictionary > "}"' : ' punctuation.definition.dictionary'
327+ ' dictionary_comprehension > "{"' : ' punctuation.definition.dictionary'
328+ ' dictionary_comprehension > "}"' : ' punctuation.definition.dictionary'
329+
330+ ' set > "{"' : ' punctuation.definition.set'
331+ ' set > "}"' : ' punctuation.definition.set'
332+ ' set_comprehension > "{"' : ' punctuation.definition.set'
333+ ' set_comprehension > "}"' : ' punctuation.definition.set'
334+
335+ ' interpolation > "{"' : ' punctuation.definition.interpolation'
336+ ' interpolation > "}"' : ' punctuation.definition.interpolation'
337+
338+ ' format_expression > "{"' : ' punctuation.definition.format'
339+ ' format_expression > "}"' : ' punctuation.definition.format'
340+ ' format_specifier > ":"' : ' punctuation.definition.format'
112341
113- ' parameters > identifier' : ' variable.parameter.function'
114- ' parameters > list_splat > identifier' : ' variable.parameter.function'
115- ' parameters > dictionary_splat > identifier' : ' variable.parameter.function'
116- ' default_parameter > identifier:nth-child(0)' : ' variable.parameter.function'
117- ' keyword_argument > identifier:nth-child(0)' : ' variable.parameter.function'
118-
119- ' "if"' : ' keyword.control'
120- ' "else"' : ' keyword.control'
121- ' "elif"' : ' keyword.control'
122- ' "while"' : ' keyword.control'
123- ' "for"' : ' keyword.control'
124- ' "return"' : ' keyword.control'
125- ' "break"' : ' keyword.control'
126- ' "continue"' : ' keyword.control'
127- ' "pass"' : ' keyword.control'
128- ' "raise"' : ' keyword.control'
129- ' "yield"' : ' keyword.control'
130- ' "await"' : ' keyword.control'
131- ' "async"' : ' keyword.control'
132- ' "try"' : ' keyword.control'
133- ' "except"' : ' keyword.control'
134- ' "with"' : ' keyword.control'
135- ' "as"' : ' keyword.control'
136- ' "finally"' : ' keyword.control'
137- ' "import"' : ' keyword.control'
138- ' "from"' : ' keyword.control'
139-
140- ' "print"' : ' keyword.other'
141- ' "assert"' : ' keyword.other'
142- ' "exec"' : ' keyword.other'
143- ' "del"' : ' keyword.other'
144-
145- ' "+"' : ' keyword.operator'
146- ' "-"' : ' keyword.operator'
147- ' "*"' : ' keyword.operator'
148- ' "/"' : ' keyword.operator'
149- ' "%"' : ' keyword.operator'
150- ' "**"' : ' keyword.operator'
151- ' "//"' : ' keyword.operator'
152- ' "=="' : ' keyword.operator'
153- ' "!="' : ' keyword.operator'
154- ' "<>"' : ' keyword.operator'
155- ' ">"' : ' keyword.operator'
156- ' "<"' : ' keyword.operator'
157- ' ">="' : ' keyword.operator'
158- ' "<="' : ' keyword.operator'
159- ' "="' : ' keyword.operator'
160- ' "+="' : ' keyword.operator'
161- ' "-="' : ' keyword.operator'
162- ' "*="' : ' keyword.operator'
163- ' "/="' : ' keyword.operator'
164- ' "%="' : ' keyword.operator'
165- ' "**="' : ' keyword.operator'
166- ' "//="' : ' keyword.operator'
167- ' "&"' : ' keyword.operator'
168- ' "|"' : ' keyword.operator'
169- ' "^"' : ' keyword.operator'
170- ' "~"' : ' keyword.operator'
171- ' "<<"' : ' keyword.operator'
172- ' ">>"' : ' keyword.operator'
173- ' binary_operator > "@"' : ' keyword.operator'
174- ' binary_operator > "@="' : ' keyword.operator'
175- ' "in"' : ' keyword.operator.logical.python'
176- ' "and"' : ' keyword.operator.logical.python'
177- ' "or"' : ' keyword.operator.logical.python'
178- ' "not"' : ' keyword.operator.logical.python'
179- ' "is"' : ' keyword.operator.logical.python'
342+ ' ERROR > "."' : ' punctuation.accessor.invalid.illegal'
343+ ' ERROR > ","' : ' punctuation.separator.invalid.illegal'
344+ ' ERROR > ";"' : ' punctuation.terminator.invalid.illegal'
345+ ' ERROR > ":"' : ' punctuation.definition.invalid.illegal'
346+ ' ERROR > "{"' : ' punctuation.definition.invalid.illegal'
347+ ' ERROR > "}"' : ' punctuation.definition.invalid.illegal'
348+ ' ERROR > "("' : ' punctuation.definition.invalid.illegal'
349+ ' ERROR > ")"' : ' punctuation.definition.invalid.illegal'
350+ ' ERROR > "["' : ' punctuation.definition.invalid.illegal'
351+ ' ERROR > "]"' : ' punctuation.definition.invalid.illegal'
352+ ' ERROR > "\\ ""' : ' punctuation.definition.string.invalid.illegal'
0 commit comments