105105 syn match pythonStatement ' \< async\s\+ def\> ' nextgroup =pythonFunction skipwhite
106106 syn match pythonStatement ' \< async\s\+ with\> '
107107 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\+ .\+ :'
108110 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
109111endif
110112
@@ -195,21 +197,21 @@ syn match pythonUniEscapeError '\\N{[^A-Z ]\+}' display contained
195197
196198if s: Python2Syntax ()
197199 " 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
202204else
203205 " 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
213215endif
214216
215217if s: Python2Syntax ()
@@ -225,25 +227,25 @@ endif
225227
226228" Python 2/3 raw strings
227229if 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
232234else
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
247249endif
248250
249251syn match pythonRawEscape + \\ ['"]+ display contained
@@ -409,7 +411,7 @@ if s:Enabled('g:python_highlight_exceptions')
409411 if s: Python2Syntax ()
410412 let s: exs_re .= ' |StandardError'
411413 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 '
413415 endif
414416
415417 execute ' syn match pythonExClass '' \v\.@<!\zs<%(' . s: exs_re . ' )>'' '
0 commit comments