|
@@ -136,6 +136,7 @@ if s:Enabled("g:python_highlight_all")
|
136
|
136
|
call s:EnableByDefault("g:python_highlight_builtin_objs")
|
137
|
137
|
call s:EnableByDefault("g:python_highlight_builtin_funcs")
|
138
|
138
|
endif
|
|
139
|
+ call s:EnableByDefault("g:python_highlight_type_annotations")
|
139
|
140
|
call s:EnableByDefault("g:python_highlight_exceptions")
|
140
|
141
|
call s:EnableByDefault("g:python_highlight_string_formatting")
|
141
|
142
|
call s:EnableByDefault("g:python_highlight_string_format")
|
|
@@ -171,15 +172,19 @@ syn region pythonDictSetExpr matchgroup=pythonDictSetExpr start='{' end='}' cont
|
171
|
172
|
syn region pythonListSliceExpr matchgroup=pythonListSliceExpr start='\[' end='\]' contains=@pythonExpression
|
172
|
173
|
syn region pythonFuncArgs matchgroup=pythonFuncArgs start='(' end=')' contained contains=pythonTypeAnno,@pythonExpression
|
173
|
174
|
|
174
|
|
-syn match pythonTypeAnno ":\s*\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"hs=s+1 display contained contains=pythonType nextgroup=pythonTypeArgs
|
175
|
|
-syn match pythonTypeAnnoReturn "->\s*\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contains=pythonType nextgroup=pythonTypeArgs
|
176
|
|
-syn region pythonTypeArgs matchgroup=pythonTypeArgs start='\[' end='\]' display contained contains=pythonType,pythonTypeArgs
|
177
|
|
-syn keyword pythonType Any AnyStr Callable ClassVar Tuple Union Optional Type TypeVar None contained
|
178
|
|
-syn keyword pythonType AbstractSet MutableSet Mapping MutableMapping Sequence MutableSequence ByteString Deque List contained
|
179
|
|
-syn keyword pythonType Set FrozenSet MappingView KeysView ItemsView ValuesView Awaitable Coroutine AsyncIterable contained
|
180
|
|
-syn keyword pythonType AsyncIterator ContextManager Dict DefaultDict Generator AsyncGenerator Text NamedTuple contained
|
181
|
|
-syn keyword pythonType Iterable Iterator Reversible SupportsInt SupportsFloat SupportsAbs SupportsRound Container contained
|
182
|
|
-syn keyword pythonType Hashable Sized Collection contained
|
|
175
|
+if !s:Python2Syntax()
|
|
176
|
+ if s:Enabled("g:python_highlight_type_annotations")
|
|
177
|
+ syn match pythonTypeAnno ":\s*\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"hs=s+1 display contained contains=pythonType nextgroup=pythonTypeArgs
|
|
178
|
+ syn match pythonTypeAnnoReturn "->\s*\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contains=pythonType nextgroup=pythonTypeArgs
|
|
179
|
+ syn region pythonTypeArgs matchgroup=pythonTypeArgs start='\[' end='\]' display contained contains=pythonType,pythonTypeArgs
|
|
180
|
+ syn keyword pythonType Any AnyStr Callable ClassVar Tuple Union Optional Type TypeVar None contained
|
|
181
|
+ syn keyword pythonType AbstractSet MutableSet Mapping MutableMapping Sequence MutableSequence ByteString Deque List contained
|
|
182
|
+ syn keyword pythonType Set FrozenSet MappingView KeysView ItemsView ValuesView Awaitable Coroutine AsyncIterable contained
|
|
183
|
+ syn keyword pythonType AsyncIterator ContextManager Dict DefaultDict Generator AsyncGenerator Text NamedTuple contained
|
|
184
|
+ syn keyword pythonType Iterable Iterator Reversible SupportsInt SupportsFloat SupportsAbs SupportsRound Container contained
|
|
185
|
+ syn keyword pythonType Hashable Sized Collection contained
|
|
186
|
+ endif
|
|
187
|
+endif
|
183
|
188
|
|
184
|
189
|
syn match pythonStatement "\<yield\>" display
|
185
|
190
|
syn match pythonImport "\<from\>" display
|