@@ -65,115 +65,277 @@ 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.conclusion'
75+ ' "break"' : ' keyword.control.conclusion'
76+ ' "continue"' : ' keyword.control.conclusion'
77+ ' "pass"' : ' keyword.control.conclusion'
78+ ' "yield"' : ' keyword.control.conclusion'
79+ ' "raise"' : ' keyword.control.conclusion'
80+ ' "try"' : ' keyword.control.exception'
81+ ' "except"' : ' keyword.control.exception'
82+ ' "finally"' : ' keyword.control.exception'
83+ ' "import"' : ' keyword.control.package'
84+ ' "from"' : ' keyword.control.package'
85+ ' "with"' : ' keyword.control.evaluate'
86+ ' "as"' : ' keyword.control.evaluate'
87+ ' "assert"' : ' keyword.control.evaluate'
88+ ' "await"' : ' keyword.control.asynchronous'
89+ ' "async"' : ' keyword.control.asynchronous'
90+
91+ ' "print"' : ' keyword.control.print'
92+ ' "exec"' : ' keyword.control.exec'
93+
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+
135+ ' "class"' : ' storage.type.language.class'
136+ ' "def"' : ' storage.type.language.function'
137+ ' "lambda"' : ' storage.type.language.function'
138+
139+ '''
140+ type > identifier,
141+ type > subscript > identifier
142+ ''' : [
143+ {
144+ match : ' ^(bool|bytearray|bytes|complex|dict|float|frozenset|int|list|memoryview|object|range|set|str|tuple)$' ,
145+ scopes : ' storage.type.language.variable'
146+ },
147+ ' storage.type.entity'
148+ ]
149+
150+ # Entity
151+ '''
152+ identifier,
153+ class_definition > argument_list > identifier,
154+ class_definition > argument_list > keyword_argument > identifier:nth-child(2)
155+ ''' : [
156+ {
157+ exact : ' cls' ,
158+ scopes : ' entity.variable.support.cls'
159+ },
160+ {
161+ exact : ' self' ,
162+ scopes : ' entity.variable.support.self'
163+ }
164+ ]
165+
166+ '''
167+ parameters > identifier,
168+ parameters > list_splat > identifier,
169+ parameters > dictionary_splat > identifier,
170+ default_parameter > identifier:nth-child(0),
171+ keyword_argument > identifier:nth-child(0)
172+ ''' : [
173+ {
174+ exact : ' cls' ,
175+ scopes : ' entity.variable.support.parameter.cls'
176+ },
177+ {
178+ exact : ' self' ,
179+ scopes : ' entity.variable.support.parameter.self'
180+ },
181+ ' entity.variable.parameter'
182+ ]
183+
184+ ' identifier' : [
185+ {
186+ 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)$' ,
187+ scopes : ' entity.type.class.exception.support'
188+ },
189+ ' entity.variable'
190+ ]
191+
192+ '''
193+ class_definition > argument_list > identifier,
194+ class_definition > argument_list > keyword_argument > identifier:nth-child(2)
195+ ''' : [
196+ {
197+ 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)$' ,
198+ scopes : ' entity.type.class.exception.inherited.support'
199+ },
200+ ' entity.type.class.inherited'
201+ ]
74202
75- ' class_definition > identifier' : ' entity.name.type.class'
76- ' function_definition > identifier' : ' entity.name.function'
77203 ' 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'
204+ {
205+ match : ' ^(bool|bytearray|bytes|complex|dict|float|frozenset|int|list|memoryview|object|range|set|str|tuple)$' ,
206+ scopes : ' entity.function.type.language.call'
207+ },
208+ {
209+ exact : ' super' ,
210+ scopes : ' entity.function.support.call.super'
211+ },
212+ {
213+ 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__)$' ,
214+ scopes : ' entity.function.support.call'
215+ },
216+ ' entity.function.call'
217+ ]
218+
219+ ' decorator > dotted_name > identifier' : [
220+ {
221+ match : ' ^(classmethod|property|staticmethod)$' ,
222+ scopes : ' entity.function.support'
223+ },
224+ ' entity'
225+ ]
226+
227+ ' call > attribute > identifier:nth-child(2)' : ' entity.function.method.call'
228+
229+ ' function_definition > identifier' : ' entity.function.definition'
230+
231+ ' decorator' : ' entity.decorator'
232+
233+ ' attribute > identifier:nth-child(2)' : ' entity.variable.member'
83234
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' }
235+ ' class_definition > identifier' : ' entity.type.class.definition'
88236
89- ' attribute > identifier:nth-child(2)' : ' variable.other.object.property'
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'
90243
91- ' decorator' : ' entity.name.function.decorator'
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'
262+ ' none' : ' constant.language.null '
263+ ' true' : ' constant.language.boolean '
264+ ' false' : ' constant.language.boolean '
96265 ' integer' : ' constant.numeric'
97266 ' float' : ' constant.numeric'
267+ ' ellipsis' : ' constant.language.ellipsis.symbol'
98268
99- ' type > identifier' : ' support.storage.type'
269+ # Comment
270+ ' comment' : ' comment.line'
100271
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 '
272+ # Punctuation
273+ ' "." ' : ' punctuation.accessor '
274+ ' "," ' : ' punctuation.separator '
275+ ' ":" ' : ' punctuation.definition '
105276
106- ' "class"' : ' storage.type.class'
107- ' "def"' : ' storage.type.function'
108- ' "lambda"' : ' storage.type.function'
277+ ' import_prefix > "."' : ' punctuation.definition.import.relative'
109278
110- ' "global"' : ' storage.modifier.global'
111- ' "nonlocal"' : ' storage.modifier.nonlocal'
279+ ' typed_default_parameter > ":"' : ' punctuation.definition.type'
280+ ' assignment > ":"' : ' punctuation.definition.type'
281+ ' typed_parameters > ":"' : ' punctuation.definition.type'
282+ ' "->"' : ' punctuation.definition.type.return'
283+
284+ ' slice > ":"' : ' punctuation.separator.slice'
285+ ' pair > ":"' : ' punctuation.separator.pair'
286+
287+ ' decorator > "@"' : ' punctuation.definition.decorator'
288+
289+ ' future_import_statement > "("' : ' punctuation.definition.import'
290+ ' future_import_statement > ")"' : ' punctuation.definition.import'
291+ ' import_from_statement > "("' : ' punctuation.definition.import'
292+ ' import_from_statement > ")"' : ' punctuation.definition.import'
293+
294+ ' parameters > "("' : ' punctuation.definition.parameters'
295+ ' parameters > ")"' : ' punctuation.definition.parameters'
296+
297+ ' argument_list > "("' : ' punctuation.definition.arguments'
298+ ' argument_list > ")"' : ' punctuation.definition.arguments'
299+
300+ ' parenthesized_expression > "("' : ' punctuation.definition.expression'
301+ ' parenthesized_expression > ")"' : ' punctuation.definition.expression'
302+ ' generator_expression > "("' : ' punctuation.definition.generator'
303+ ' generator_expression > ")"' : ' punctuation.definition.generator'
304+
305+ ' tuple > "("' : ' punctuation.definition.tuple'
306+ ' tuple > ")"' : ' punctuation.definition.tuple'
307+
308+ ' subscript > "["' : ' punctuation.accessor'
309+ ' subscript > "]"' : ' punctuation.accessor'
310+
311+ ' list > "["' : ' punctuation.definition.list'
312+ ' list > "]"' : ' punctuation.definition.list'
313+ ' list_comprehension > "["' : ' punctuation.definition.list'
314+ ' list_comprehension > "]"' : ' punctuation.definition.list'
315+
316+ ' dictionary > "{"' : ' punctuation.definition.dictionary'
317+ ' dictionary > "}"' : ' punctuation.definition.dictionary'
318+ ' dictionary_comprehension > "{"' : ' punctuation.definition.dictionary'
319+ ' dictionary_comprehension > "}"' : ' punctuation.definition.dictionary'
320+
321+ ' set > "{"' : ' punctuation.definition.set'
322+ ' set > "}"' : ' punctuation.definition.set'
323+ ' set_comprehension > "{"' : ' punctuation.definition.set'
324+ ' set_comprehension > "}"' : ' punctuation.definition.set'
325+
326+ ' interpolation > "{"' : ' punctuation.definition.interpolation'
327+ ' interpolation > "}"' : ' punctuation.definition.interpolation'
328+
329+ ' format_expression > "{"' : ' punctuation.definition.format'
330+ ' format_expression > "}"' : ' punctuation.definition.format'
331+ ' format_specifier > ":"' : ' punctuation.definition.format'
112332
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'
333+ ' ERROR > "."' : ' punctuation.invalid.illegal'
334+ ' ERROR > ","' : ' punctuation.invalid.illegal'
335+ ' ERROR > ":"' : ' punctuation.invalid.illegal'
336+ ' ERROR > "{"' : ' punctuation.invalid.illegal'
337+ ' ERROR > "}"' : ' punctuation.invalid.illegal'
338+ ' ERROR > "("' : ' punctuation.invalid.illegal'
339+ ' ERROR > ")"' : ' punctuation.invalid.illegal'
340+ ' ERROR > "["' : ' punctuation.invalid.illegal'
341+ ' ERROR > "]"' : ' punctuation.invalid.illegal'
0 commit comments