@@ -367,66 +367,36 @@ endif
367367"
368368
369369if s: Enabled (' g:python_highlight_builtin_funcs' )
370+ let s: funcs_re = ' __import__|abs|all|any|bin|chr|classmethod|cmp|compile|complex|delattr|dir|divmod|enumerate|eval|filter|format|getattr|globals|hasattr|hash|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|min|next|oct|open|ord|pow|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip'
371+
370372 if s: Python2Syntax ()
371- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(apply|basestring|buffer|callable|coerce)>\z e\( ' nextgroup =FunctionParameters
372- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(execfile|file|help|intern|long|raw_input)>\z e\( ' nextgroup =FunctionParameters
373- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(reduce|reload|unichr|unicode|xrange)>\z e\( ' nextgroup =FunctionParameters
373+ let s: funcs_re .= ' |apply|basestring|buffer|callable|coerce|execfile|file|help|intern|long|raw_input|reduce|reload|unichr|unicode|xrange'
374374 if s: Enabled (' g:python_print_as_function' )
375- syn match pythonBuiltinFunc ' \v\. @<! \z s< print> \z e \( ' nextgroup = FunctionParameters
375+ let s: funcs_re .= ' | print'
376376 endif
377377 else
378- syn match pythonBuiltinFunc ' \v\. @<! \z s<%( ascii|exec|memoryview|print)> \z e \( ' nextgroup = FunctionParameters
378+ let s: funcs_re .= ' | ascii|exec|memoryview|print'
379379 endif
380- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(__import__|abs|all|any)>\z e\( ' nextgroup =FunctionParameters
381- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(bin|chr|classmethod|cmp|compile|complex)>\z e\( ' nextgroup =FunctionParameters
382- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(delattr|dir|divmod|enumerate|eval)>\z e\( ' nextgroup =FunctionParameters
383- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(filter|format|getattr)>\z e\( ' nextgroup =FunctionParameters
384- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(globals|hasattr|hash|hex|id)>\z e\( ' nextgroup =FunctionParameters
385- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(input|isinstance)>\z e\( ' nextgroup =FunctionParameters
386- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(issubclass|iter|len|locals|map|max)>\z e\( ' nextgroup =FunctionParameters
387- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(min|next|oct|open|ord)>\z e\( ' nextgroup =FunctionParameters
388- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(pow|property|range)>\z e\( ' nextgroup =FunctionParameters
389- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(repr|reversed|round|setattr)>\z e\( ' nextgroup =FunctionParameters
390- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(slice|sorted|staticmethod|sum|super)>\z e\( ' nextgroup =FunctionParameters
391- syn match pythonBuiltinFunc ' \v\. @<!\z s<%(type|vars|zip)>\z e\( ' nextgroup =FunctionParameters
380+
381+ execute ' syn match pythonBuiltinFunc '' \v\.@<!\zs<%(' . s: funcs_re . ' )>\ze\('' nextgroup=FunctionParameters'
382+ unlet s: funcs_re
392383endif
393384
394385"
395386" Builtin exceptions and warnings
396387"
397388
398389if s: Enabled (' g:python_highlight_exceptions' )
390+ let s: exs_re = ' BaseException|Exception|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|BufferError|EOFError|FloatingPointError|GeneratorExit|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StopIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|VMSError|WindowsError|ZeroDivisionError|Warning|UserWarning|BytesWarning|DeprecationWarning|PendingDepricationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning'
391+
399392 if s: Python2Syntax ()
400- syn match pythonExClass ' \v\. @<! \z s<%( StandardError)> ' nextgroup = FunctionParameters
393+ let s: exs_re .= ' | StandardError'
401394 else
402- syn match pythonExClass ' \v\. @<!\z s<%(BlockingIOError|ChildProcessError)>' nextgroup =FunctionParameters
403- syn match pythonExClass ' \v\. @<!\z s<%(ConnectionError|BrokenPipeError)>' nextgroup =FunctionParameters
404- syn match pythonExClass ' \v\. @<!\z s<%(ConnectionAbortedError|ConnectionRefusedError)>' nextgroup =FunctionParameters
405- syn match pythonExClass ' \v\. @<!\z s<%(ConnectionResetError|FileExistsError)>' nextgroup =FunctionParameters
406- syn match pythonExClass ' \v\. @<!\z s<%(FileNotFoundError|InterruptedError)>' nextgroup =FunctionParameters
407- syn match pythonExClass ' \v\. @<!\z s<%(IsADirectoryError|NotADirectoryError)>' nextgroup =FunctionParameters
408- syn match pythonExClass ' \v\. @<!\z s<%(PermissionError|ProcessLookupError TimeoutError)>' nextgroup =FunctionParameters
409- syn match pythonExClass ' \v\. @<!\z s<%(StopAsyncIteration|ResourceWarning)>' nextgroup =FunctionParameters
395+ let s: exs_re .= ' |BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning'
410396 endif
411397
412- syn match pythonExClass ' \v\. @<!<%(BaseException|Exception|ArithmeticError)>' nextgroup =FunctionParameters
413- syn match pythonExClass ' \v\. @<!\z s<%(LookupError|EnvironmentError|AssertionError)>' nextgroup =FunctionParameters
414- syn match pythonExClass ' \v\. @<!\z s<%(AttributeError|BufferError|EOFError)>' nextgroup =FunctionParameters
415- syn match pythonExClass ' \v\. @<!\z s<%(FloatingPointError|GeneratorExit|IOError)>' nextgroup =FunctionParameters
416- syn match pythonExClass ' \v\. @<!\z s<%(ImportError|IndexError|KeyError)>' nextgroup =FunctionParameters
417- syn match pythonExClass ' \v\. @<!\z s<%(KeyboardInterrupt|MemoryError|NameError)>' nextgroup =FunctionParameters
418- syn match pythonExClass ' \v\. @<!\z s<%(NotImplementedError|OSError|OverflowError)>' nextgroup =FunctionParameters
419- syn match pythonExClass ' \v\. @<!\z s<%(ReferenceError|RuntimeError|StopIteration)>' nextgroup =FunctionParameters
420- syn match pythonExClass ' \v\. @<!\z s<%(SyntaxError|IndentationError|TabError)>' nextgroup =FunctionParameters
421- syn match pythonExClass ' \v\. @<!\z s<%(SystemError|SystemExit|TypeError)>' nextgroup =FunctionParameters
422- syn match pythonExClass ' \v\. @<!\z s<%(UnboundLocalError|UnicodeError)>' nextgroup =FunctionParameters
423- syn match pythonExClass ' \v\. @<!\z s<%(UnicodeEncodeError|UnicodeDecodeError)>' nextgroup =FunctionParameters
424- syn match pythonExClass ' \v\. @<!\z s<%(UnicodeTranslateError|ValueError|VMSError)>' nextgroup =FunctionParameters
425- syn match pythonExClass ' \v\. @<!\z s<%(WindowsError|ZeroDivisionError)>' nextgroup =FunctionParameters
426- syn match pythonExClass ' \v\. @<!\z s<%(Warning|UserWarning|BytesWarning|DeprecationWarning)>' nextgroup =FunctionParameters
427- syn match pythonExClass ' \v\. @<!\z s<%(PendingDepricationWarning|SyntaxWarning)>' nextgroup =FunctionParameters
428- syn match pythonExClass ' \v\. @<!\z s<%(RuntimeWarning|FutureWarning)>' nextgroup =FunctionParameters
429- syn match pythonExClass ' \v\. @<!\z s<%(ImportWarning|UnicodeWarning)>' nextgroup =FunctionParameters
398+ execute ' syn match pythonExClass '' \v\.@<!\zs<%(' . s: exs_re . ' )>'' nextgroup=FunctionParameters'
399+ unlet s: exs_re
430400endif
431401
432402if s: Enabled (' g:python_slow_sync' )
0 commit comments