Skip to content

Commit 51ea0da

Browse files
committed
syntax: Remove pythonFunctionArgs as it's poorly implemented
1 parent c830030 commit 51ea0da

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

syntax/python.vim

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ syn keyword pythonOperator and in is not or
7878
" we provide a dummy group here to avoid crashing pyrex.vim.
7979
syn keyword pythonInclude import
8080
syn keyword pythonImport import
81-
syn match pythonIdentifier '\v[a-zA-Z_][a-zA-Z0-9_]*' nextgroup=pythonFunctionArgs
81+
syn match pythonIdentifier '\v[a-zA-Z_][a-zA-Z0-9_]*'
8282
syn match pythonRaiseFromStatement '\<from\>'
8383
syn match pythonImport '^\s*\zsfrom\>'
8484

@@ -89,28 +89,26 @@ if s:Python2Syntax()
8989
syn keyword pythonStatement print
9090
endif
9191
syn keyword pythonImport as
92-
syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' nextgroup=pythonFunctionArgs display contained
92+
syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' display contained
9393
else
9494
syn keyword pythonStatement as nonlocal
9595
syn match pythonStatement '\v\.@<!<await>'
96-
syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' nextgroup=pythonFunctionArgs display contained
96+
syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' display contained
9797
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
9898
syn match pythonStatement '\<async\s\+with\>'
9999
syn match pythonStatement '\<async\s\+for\>'
100100
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonBuiltinObj,pythonBuiltinFunc
101101
endif
102102

103-
syn region pythonFunctionArgs start='('rs=s+1 end=')'re=e-1 contains=pythonFunctionArgs,pythonFunctionKwargs,pythonRepeat,pythonClassVar,pythonConditional,pythonComment,pythonOperator,pythonNumber,pythonNumberError,pythonFloat,pythonHexNumber,pythonStatement,pythonOctNumber,pythonString,pythonRawString,pythonUniString,pythonExClass,pythonUniRawString,pythonNumber,pythonRawString,pythonBytes,pythonBuiltinObj,pythonNone,pythonBuiltinFunc,pythonBoolean nextgroup=pythonRaiseFromStatement display contained
104-
syn match pythonFunctionKwargs /\i\+\ze=/ display contained
105103
"
106104
" Decorators (new in Python 2.4)
107105
"
108106

109107
syn match pythonDecorator '^\s*\zs@' display nextgroup=pythonDottedName skipwhite
110108
if s:Python2Syntax()
111-
syn match pythonDottedName '[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*' display contained nextgroup=pythonFunctionArgs
109+
syn match pythonDottedName '[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*' display contained
112110
else
113-
syn match pythonDottedName '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*' display contained nextgroup=pythonFunctionArgs
111+
syn match pythonDottedName '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*' display contained
114112
endif
115113
syn match pythonDot '\.' display containedin=pythonDottedName
116114

@@ -332,7 +330,7 @@ if s:Enabled('g:python_highlight_builtin_objs')
332330
syn keyword pythonNone None
333331
syn keyword pythonBoolean True False
334332
syn keyword pythonBuiltinObj Ellipsis NotImplemented
335-
syn match pythonBuiltinObj '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>' nextgroup=pythonFunctionArgs
333+
syn match pythonBuiltinObj '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>'
336334
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
337335
syn keyword pythonBuiltinObj __loader__ __spec__ __path__ __cached__
338336
endif
@@ -353,7 +351,7 @@ if s:Enabled('g:python_highlight_builtin_funcs')
353351
let s:funcs_re .= '|ascii|exec|memoryview|print'
354352
endif
355353

356-
execute 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'' nextgroup=pythonFunctionArgs'
354+
execute 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'''
357355
unlet s:funcs_re
358356
endif
359357

@@ -370,7 +368,7 @@ if s:Enabled('g:python_highlight_exceptions')
370368
let s:exs_re .= '|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning'
371369
endif
372370

373-
execute 'syn match pythonExClass ''\v\.@<!\zs<%(' . s:exs_re . ')>'' nextgroup=pythonFunctionArgs'
371+
execute 'syn match pythonExClass ''\v\.@<!\zs<%(' . s:exs_re . ')>'''
374372
unlet s:exs_re
375373
endif
376374

@@ -463,7 +461,6 @@ if v:version >= 508 || !exists('did_python_syn_inits')
463461

464462
HiLink pythonExClass Structure
465463
HiLink pythonClassVar Identifier
466-
HiLink pythonFunctionKwargs Identifier
467464

468465
delcommand HiLink
469466
endif

0 commit comments

Comments
 (0)