@@ -150,6 +150,7 @@ endif
150150" Keywords
151151"
152152
153+ syn keyword pythonInstanceVariable self
153154syn keyword pythonStatement break continue del
154155syn keyword pythonStatement exec return
155156syn keyword pythonStatement pass raise
@@ -174,18 +175,31 @@ if s:Python2Syntax()
174175 syn keyword pythonStatement print
175176 endif
176177 syn keyword pythonImport as
177- syn match pythonFunction " [a-zA-Z_][a-zA-Z0-9_]*" display contained
178+ syn match pythonFunction " [a-zA-Z_][a-zA-Z0-9_]*" nextgroup = FunctionParameters display contained
178179else
179- syn keyword pythonStatement as nonlocal None
180+ syn keyword pythonStatement as nonlocal
180181 syn match pythonStatement " \< yield\s\+ from\> " display
181- syn keyword pythonBoolean True False
182182 syn match pythonFunction " \% ([^[:cntrl:][:space:][:punct:][:digit:]]\| _\)\% ([^[:cntrl:][:punct:][:space:]]\| _\) *" display contained
183183 syn keyword pythonStatement await
184184 syn match pythonStatement " \< async\s\+ def\> " nextgroup =pythonFunction skipwhite
185185 syn match pythonStatement " \< async\s\+ with\> " display
186186 syn match pythonStatement " \< async\s\+ for\> " display
187187endif
188188
189+ syn region FunctionParameters start =' (' end =' )' contains =
190+ \ OptionalParameters,
191+ \ pythonInstanceVariable,
192+ \ pythonHexNumber,
193+ \ pythonOctNumber,
194+ \ pythonString,
195+ \ pythonUniString,
196+ \ pythonUniRawString,
197+ \ pythonNumber,
198+ \ pythonRawString,
199+ \ pythonBuiltinObj,
200+ \ pythonBuiltinFunc
201+ \ nextgroup= OptionalParameters
202+ syn match OptionalParameters / \i *\z e=/ display contained
189203"
190204" Decorators (new in Python 2.4)
191205"
@@ -398,11 +412,11 @@ syn match pythonFloat "\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=" display
398412"
399413
400414if s: Enabled (" g:python_highlight_builtin_objs" )
401- if s: Python2Syntax ()
402- syn keyword pythonBuiltinObj None
403- syn keyword pythonBoolean True False
404- endif
415+ syn keyword pythonBuiltinObj None
416+ syn keyword pythonBoolean True False
405417 syn keyword pythonBuiltinObj Ellipsis NotImplemented
418+ syn keyword pythonBuiltinObj int float tuple str list dict set frozenset
419+ syn keyword pythonBuiltinObj defaultdict
406420 syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
407421endif
408422
@@ -424,15 +438,15 @@ if s:Enabled("g:python_highlight_builtin_funcs")
424438 syn keyword pythonBuiltinFunc __import__ abs all any
425439 syn keyword pythonBuiltinFunc bin bool bytearray bytes
426440 syn keyword pythonBuiltinFunc chr classmethod cmp compile complex
427- syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
428- syn keyword pythonBuiltinFunc filter float format frozenset getattr
441+ syn keyword pythonBuiltinFunc delattr dir divmod enumerate eval
442+ syn keyword pythonBuiltinFunc filter format getattr
429443 syn keyword pythonBuiltinFunc globals hasattr hash hex id
430- syn keyword pythonBuiltinFunc input int isinstance
431- syn keyword pythonBuiltinFunc issubclass iter len list locals map max
444+ syn keyword pythonBuiltinFunc input isinstance
445+ syn keyword pythonBuiltinFunc issubclass iter len locals map max
432446 syn keyword pythonBuiltinFunc min next object oct open ord
433447 syn keyword pythonBuiltinFunc pow property range
434- syn keyword pythonBuiltinFunc repr reversed round set setattr
435- syn keyword pythonBuiltinFunc slice sorted staticmethod str sum super tuple
448+ syn keyword pythonBuiltinFunc repr reversed round setattr
449+ syn keyword pythonBuiltinFunc slice sorted staticmethod sum super
436450 syn keyword pythonBuiltinFunc type vars zip
437451endif
438452
@@ -561,6 +575,8 @@ if version >= 508 || !exists("did_python_syn_inits")
561575 HiLink pythonBuiltinFunc Function
562576
563577 HiLink pythonExClass Structure
578+ HiLink pythonInstanceVariable htmlTagN
579+ HiLink OptionalParameters htmlTagN
564580
565581 delcommand HiLink
566582endif
0 commit comments