Skip to content

Commit b487a11

Browse files
committed
add python function calls and built in errors
1 parent 58d6e01 commit b487a11

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

syntax/python.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ if s:Python2Syntax()
8888
else
8989
syn keyword pythonStatement as nonlocal
9090
syn match pythonStatement '\v\.@<!<await>'
91+
syn match pythonFunctionCall '\v([^[:cntrl:][:space:][:punct:][:digit:]]|_)([^[:cntrl:][:punct:][:space:]]|_)*\ze(\s?\()' display
9192
syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
9293
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
9394
syn match pythonStatement '\<async\s\+with\>'
@@ -385,6 +386,27 @@ if s:Enabled('g:python_highlight_exceptions')
385386
unlet s:exs_re
386387
endif
387388

389+
" Builtin exceptions and warnings
390+
syn keyword pythonExClass BaseException
391+
syn keyword pythonExClass Exception StandardError ArithmeticError
392+
syn keyword pythonExClass LookupError EnvironmentError
393+
syn keyword pythonExClass AssertionError AttributeError BufferError EOFError
394+
syn keyword pythonExClass FloatingPointError GeneratorExit IOError
395+
syn keyword pythonExClass ImportError IndexError KeyError
396+
syn keyword pythonExClass KeyboardInterrupt MemoryError NameError
397+
syn keyword pythonExClass NotImplementedError OSError OverflowError
398+
syn keyword pythonExClass ReferenceError RuntimeError StopIteration
399+
syn keyword pythonExClass SyntaxError IndentationError TabError
400+
syn keyword pythonExClass SystemError SystemExit TypeError
401+
syn keyword pythonExClass UnboundLocalError UnicodeError
402+
syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError
403+
syn keyword pythonExClass UnicodeTranslateError ValueError VMSError
404+
syn keyword pythonExClass WindowsError ZeroDivisionError
405+
syn keyword pythonExClass Warning UserWarning BytesWarning DeprecationWarning
406+
syn keyword pythonExClass PendingDepricationWarning SyntaxWarning
407+
syn keyword pythonExClass RuntimeWarning FutureWarning
408+
syn keyword pythonExClass ImportWarning UnicodeWarning
409+
388410
if s:Enabled('g:python_slow_sync')
389411
syn sync minlines=2000
390412
else
@@ -407,10 +429,12 @@ if v:version >= 508 || !exists('did_python_syn_inits')
407429
HiLink pythonRaiseFromStatement Statement
408430
HiLink pythonImport Include
409431
HiLink pythonFunction Function
432+
HiLink pythonFunctionCall Identifier
410433
HiLink pythonConditional Conditional
411434
HiLink pythonRepeat Repeat
412435
HiLink pythonException Exception
413436
HiLink pythonOperator Operator
437+
HiLink pythonExClass Special
414438

415439
HiLink pythonDecorator Define
416440
HiLink pythonDottedName Function

0 commit comments

Comments
 (0)