diff runtime/syntax/python.vim @ 29533:34c1f4cd0c18

Update runtime files Commit: https://github.com/vim/vim/commit/2ecbe53f452e92e941aff623f6a0b72f80e43d07 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 29 21:36:21 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Fri, 29 Jul 2022 22:45:04 +0200
parents 3a63b1e4a6f4
children b2412874362f
line wrap: on
line diff
--- a/runtime/syntax/python.vim
+++ b/runtime/syntax/python.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Python
 " Maintainer:	Zvezdan Petkovic <zpetkovic@acm.org>
-" Last Change:	2021 Dec 10
+" Last Change:	2022 Jun 28
 " Credits:	Neil Schemenauer <nas@python.ca>
 "		Dmitry Vasiliev
 "
@@ -84,13 +84,19 @@ syn keyword pythonStatement	as assert br
 syn keyword pythonStatement	lambda nonlocal pass return with yield
 syn keyword pythonStatement	class def nextgroup=pythonFunction skipwhite
 syn keyword pythonConditional	elif else if
-syn keyword pythonConditional	case match
 syn keyword pythonRepeat	for while
 syn keyword pythonOperator	and in is not or
 syn keyword pythonException	except finally raise try
 syn keyword pythonInclude	from import
 syn keyword pythonAsync		async await
 
+" Soft keywords
+" These keywords do not mean anything unless used in the right context
+" See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords 
+" for more on this.
+syn match   pythonConditional   "^\s*\zscase\%(\s\+.*:.*$\)\@="
+syn match   pythonConditional   "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@="
+
 " Decorators
 " A dot must be allowed because of @MyClass.myfunc decorators.
 syn match   pythonDecorator	"@" display contained