@@ -154,7 +154,8 @@ syn keyword pythonInstanceVariable self
154154syn keyword pythonClassVaraible cls
155155syn keyword pythonStatement break continue del
156156syn keyword pythonStatement exec return
157- syn keyword pythonStatement pass raise
157+ syn keyword pythonStatement pass
158+ syn keyword pythonStatement raise nextgroup =pythonIdentifier skipwhite
158159syn keyword pythonStatement global assert
159160syn keyword pythonStatement lambda
160161syn keyword pythonStatement with
@@ -163,14 +164,16 @@ syn keyword pythonRepeat for while
163164syn keyword pythonConditional if elif else
164165" The standard pyrex.vim unconditionally removes the pythonInclude group, so
165166" we provide a dummy group here to avoid crashing pyrex.vim.
166- syn keyword pythonInclude import
167- syn keyword pythonImport import
168- syn keyword pythonImport from
169167syn keyword pythonException try except finally
170168syn keyword pythonOperator and in is not or
171169syn match pythonStatement " \s *\( [.,]\)\@ <!\< yield\> "
170+ syn keyword pythonInclude import
171+ syn keyword pythonImport import
172+ syn match pythonIdentifier " \v [a-zA-Z_][a-zA-Z0-9_]*" nextgroup =FunctionParameters
173+ syn match pythonRaiseFromStatement " from\> "
174+ syn match pythonImport " \v ^\s *\z sfrom\z e\s *[a-zA-Z_][a-zA-Z0-9_]*(\. [a-zA-Z_][a-zA-Z0-9_]*)*\s *import"
175+
172176
173- syn match pythonIdentifier " [a-zA-Z_][a-zA-Z0-9_]*" nextgroup =FunctionParameters
174177
175178if s: Python2Syntax ()
176179 if ! s: Enabled (" g:python_print_as_function" )
@@ -180,7 +183,7 @@ if s:Python2Syntax()
180183 syn match pythonFunction " [a-zA-Z_][a-zA-Z0-9_]*" nextgroup =FunctionParameters display contained
181184else
182185 syn keyword pythonStatement as nonlocal
183- syn match pythonStatement " \v\s *<yield\s +from>"
186+ syn match pythonStatement " \v\s *<yield\s +from>"
184187 syn match pythonStatement " \v (\. )@<!<await>"
185188 syn match pythonFunction " [a-zA-Z_][a-zA-Z0-9_]*" nextgroup =FunctionParameters display contained
186189 syn match pythonStatement " \< async\s\+ def\> " nextgroup =pythonFunction skipwhite
@@ -213,8 +216,7 @@ syn region FunctionParameters start='(' end=')' display contains=
213216 \ pythonBytes,
214217 \ pythonBuiltinObj,
215218 \ pythonBuiltinFunc,
216- \ pythonBoolean
217- \ nextgroup= OptionalParameters display contained
219+ \ pythonBoolean nextgroup= pythonRaiseFromStatement display contained
218220syn match OptionalParameters / \i *\z e=/ display contained
219221"
220222" Decorators (new in Python 2.4)
@@ -526,6 +528,7 @@ if version >= 508 || !exists("did_python_syn_inits")
526528 endif
527529
528530 HiLink pythonStatement Statement
531+ HiLink pythonRaiseFromStatement Statement
529532 HiLink pythonImport Include
530533 HiLink pythonFunction Function
531534 HiLink pythonConditional Conditional
0 commit comments