105
105
syn match pythonStatement ' \< async\s\+ def\> ' nextgroup =pythonFunction skipwhite
106
106
syn match pythonStatement ' \< async\s\+ with\> '
107
107
syn match pythonStatement ' \< async\s\+ for\> '
108
+ syn match pythonConditional ' ^\s *\z smatch\z e\s\+ .\+ :'
109
+ syn match pythonConditional ' ^\s +\z scase\z e\s\+ .\+ :'
108
110
syn cluster pythonExpression contains =pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonFString,pythonRawString,pythonRawFString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType,pythonClassVar
109
111
endif
110
112
@@ -195,21 +197,21 @@ syn match pythonUniEscapeError '\\N{[^A-Z ]\+}' display contained
195
197
196
198
if s: Python2Syntax ()
197
199
" Python 2 Unicode strings
198
- syn region pythonUniString start =+ [uU]'+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
199
- syn region pythonUniString start =+ [uU]"+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
200
- syn region pythonUniString start =+ [uU]'''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
201
- syn region pythonUniString start =+ [uU]"""+ skip =+ \\ "+ end =+ """+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
200
+ syn region pythonUniString start =+ [uU]'+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
201
+ syn region pythonUniString start =+ [uU]"+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
202
+ syn region pythonUniString start =+ [uU]'''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
203
+ syn region pythonUniString start =+ [uU]"""+ skip =+ \\ "+ end =+ """+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
202
204
else
203
205
" Python 3 strings
204
- syn region pythonString start =+ '+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
205
- syn region pythonString start =+ "+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
206
- syn region pythonString start =+ '''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
207
- syn region pythonString start =+ """+ skip =+ \\ "+ end =+ """+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
208
-
209
- syn region pythonFString start =+ [fF]'+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
210
- syn region pythonFString start =+ [fF]"+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
211
- syn region pythonFString start =+ [fF]'''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
212
- syn region pythonFString start =+ [fF]"""+ skip =+ \\ "+ end =+ """+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
206
+ syn region pythonString start =+ '+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
207
+ syn region pythonString start =+ "+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
208
+ syn region pythonString start =+ '''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
209
+ syn region pythonString start =+ """+ skip =+ \\ "+ end =+ """+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
210
+
211
+ syn region pythonFString matchgroup = pythonString start =+ [fF]'+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
212
+ syn region pythonFString matchgroup = pythonString start =+ [fF]"+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
213
+ syn region pythonFString matchgroup = pythonString start =+ [fF]'''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
214
+ syn region pythonFString matchgroup = pythonString start =+ [fF]"""+ skip =+ \\ "+ end =+ """+ keepend contains =pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
213
215
endif
214
216
215
217
if s: Python2Syntax ()
@@ -225,25 +227,25 @@ endif
225
227
226
228
" Python 2/3 raw strings
227
229
if s: Python2Syntax ()
228
- syn region pythonRawString start =+ [bB]\= [rR]'+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonRawEscape,@Spell
229
- syn region pythonRawString start =+ [bB]\= [rR]"+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonRawEscape,@Spell
230
- syn region pythonRawString start =+ [bB]\= [rR]'''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
231
- syn region pythonRawString start =+ [bB]\= [rR]"""+ skip =+ \\ "+ end =+ """+ keepend contains =pythonDocTest2,pythonSpaceError,@Spell
230
+ syn region pythonRawString start =+ [bB]\= [rR]'+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonRawEscape,@Spell
231
+ syn region pythonRawString start =+ [bB]\= [rR]"+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonRawEscape,@Spell
232
+ syn region pythonRawString start =+ [bB]\= [rR]'''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
233
+ syn region pythonRawString start =+ [bB]\= [rR]"""+ skip =+ \\ "+ end =+ """+ keepend contains =pythonDocTest2,pythonSpaceError,@Spell
232
234
else
233
- syn region pythonRawString start =+ [rR]'+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonRawEscape,@Spell
234
- syn region pythonRawString start =+ [rR]"+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonRawEscape,@Spell
235
- syn region pythonRawString start =+ [rR]'''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
236
- syn region pythonRawString start =+ [rR]"""+ skip =+ \\ "+ end =+ """+ keepend contains =pythonDocTest2,pythonSpaceError,@Spell
237
-
238
- syn region pythonRawFString start =+ \% ([fF][rR]\| [rR][fF]\) '+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonRawEscape,@Spell
239
- syn region pythonRawFString start =+ \% ([fF][rR]\| [rR][fF]\) "+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonRawEscape,@Spell
240
- syn region pythonRawFString start =+ \% ([fF][rR]\| [rR][fF]\) '''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
241
- syn region pythonRawFString start =+ \% ([fF][rR]\| [rR][fF]\) """+ skip =+ \\ "+ end =+ """+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
242
-
243
- syn region pythonRawBytes start =+ \% ([bB][rR]\| [rR][bB]\) '+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonRawEscape,@Spell
244
- syn region pythonRawBytes start =+ \% ([bB][rR]\| [rR][bB]\) "+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonRawEscape,@Spell
245
- syn region pythonRawBytes start =+ \% ([bB][rR]\| [rR][bB]\) '''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
246
- syn region pythonRawBytes start =+ \% ([bB][rR]\| [rR][bB]\) """+ skip =+ \\ "+ end =+ """+ keepend contains =pythonDocTest2,pythonSpaceError,@Spell
235
+ syn region pythonRawString start =+ [rR]'+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonRawEscape,@Spell
236
+ syn region pythonRawString start =+ [rR]"+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonRawEscape,@Spell
237
+ syn region pythonRawString start =+ [rR]'''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
238
+ syn region pythonRawString start =+ [rR]"""+ skip =+ \\ "+ end =+ """+ keepend contains =pythonDocTest2,pythonSpaceError,@Spell
239
+
240
+ syn region pythonRawFString matchgroup = pythonString start =+ \% ([fF][rR]\| [rR][fF]\) '+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonRawEscape,@Spell
241
+ syn region pythonRawFString matchgroup = pythonString start =+ \% ([fF][rR]\| [rR][fF]\) "+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonRawEscape,@Spell
242
+ syn region pythonRawFString matchgroup = pythonString start =+ \% ([fF][rR]\| [rR][fF]\) '''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
243
+ syn region pythonRawFString matchgroup = pythonString start =+ \% ([fF][rR]\| [rR][fF]\) """+ skip =+ \\ "+ end =+ """+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
244
+
245
+ syn region pythonRawBytes start =+ \% ([bB][rR]\| [rR][bB]\) '+ skip =+ \\\\\|\\ '\|\\ $+ excludenl end =+ '+ end =+ $+ keepend contains =pythonRawEscape,@Spell
246
+ syn region pythonRawBytes start =+ \% ([bB][rR]\| [rR][bB]\) "+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "+ end =+ $+ keepend contains =pythonRawEscape,@Spell
247
+ syn region pythonRawBytes start =+ \% ([bB][rR]\| [rR][bB]\) '''+ skip =+ \\ '+ end =+ '''+ keepend contains =pythonDocTest,pythonSpaceError,@Spell
248
+ syn region pythonRawBytes start =+ \% ([bB][rR]\| [rR][bB]\) """+ skip =+ \\ "+ end =+ """+ keepend contains =pythonDocTest2,pythonSpaceError,@Spell
247
249
endif
248
250
249
251
syn match pythonRawEscape + \\ ['"]+ display contained
@@ -409,7 +411,7 @@ if s:Enabled('g:python_highlight_exceptions')
409
411
if s: Python2Syntax ()
410
412
let s: exs_re .= ' |StandardError'
411
413
else
412
- let s: exs_re .= ' |BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning'
414
+ let s: exs_re .= ' |BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning|ModuleNotFoundError|BaseExceptionGroup|ExceptionGroup|RecursionError|EncodingWarning '
413
415
endif
414
416
415
417
execute ' syn match pythonExClass '' \v\.@<!\zs<%(' . s: exs_re . ' )>'' '
0 commit comments