|
@@ -173,11 +173,12 @@ syn match pythonLambdaExpr "\<lambda[^:]*:"he=s+6 contains=@pythonExpression n
|
173
|
173
|
|
174
|
174
|
syn region pythonDictSetExpr matchgroup=pythonDictSetExpr start='{' end='}' contains=@pythonExpression
|
175
|
175
|
syn region pythonListSliceExpr matchgroup=pythonListSliceExpr start='\[' end='\]' contains=@pythonExpression
|
176
|
|
-syn region pythonFuncArgs matchgroup=pythonFuncArgs start='(' end=')' contained contains=pythonTypeAnno,@pythonExpression
|
|
176
|
+syn region pythonFuncArgs matchgroup=pythonFuncArgs start='(' end=')' contained contains=@pythonTypeExpression,@pythonExpression
|
177
|
177
|
|
178
|
178
|
if !s:Python2Syntax()
|
179
|
179
|
if s:Enabled("g:python_highlight_type_annotations")
|
180
|
|
- syn match pythonTypeAnno @:\s*['"]\?\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*['"]\?@hs=s+1 display contained contains=pythonType,pythonString nextgroup=pythonTypeArgs
|
|
180
|
+ syn match pythonTypeAnno @:\s*['"]\?\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*['"]\?@hs=s+1 display contained contains=pythonType,pythonString nextgroup=pythonTypeUnion,pythonTypeArgs
|
|
181
|
+ syn match pythonTypeUnion @\s*|\s*['"]\?\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*['"]\?@ display contained contains=pythonType,pythonString nextgroup=pythonTypeUnion
|
181
|
182
|
syn match pythonTypeAnnoReturn @->\s*['"]\?\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*['"]\?@ display contains=pythonType,pythonString nextgroup=pythonTypeArgs
|
182
|
183
|
syn region pythonTypeArgs matchgroup=pythonTypeArgs start='\[' end='\]' display contained contains=pythonType,pythonString,pythonTypeArgs
|
183
|
184
|
syn keyword pythonType Any AnyStr Callable ClassVar Tuple Union Optional Type TypeVar None contained
|
|
@@ -209,6 +210,8 @@ else
|
209
|
210
|
syn match pythonStatement "\<async\s\+for\>" display
|
210
|
211
|
endif
|
211
|
212
|
|
|
213
|
+syn cluster pythonTypeExpression contains=pythonTypeAnno,pythonTypeUnion,pythonTypeArgs
|
|
214
|
+
|
212
|
215
|
syn cluster pythonExpression contains=
|
213
|
216
|
\ pythonFuncArgs,
|
214
|
217
|
\ pythonDictSetExpr,
|
|
@@ -641,6 +644,7 @@ if version >= 508 || !exists("did_python_syn_inits")
|
641
|
644
|
HiLink pythonExClass Structure
|
642
|
645
|
|
643
|
646
|
HiLink pythonTypeAnno Optional
|
|
647
|
+ HiLink pythonTypeUnion Optional
|
644
|
648
|
HiLink pythonTypeAnnoReturn Optional
|
645
|
649
|
HiLink pythonTypeArgs Optional
|
646
|
650
|
HiLink pythonType Special
|