From 3f52b0fd1c9cf727cb21349f398057ff17e6ece9 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Thu, 15 Sep 2022 10:43:45 -0500 Subject: [PATCH] Merging part of Jul 29, 2022 upstream commit Correction to the earlier commit. match and case are soft keywords, they should only be highlighted within a certain context. --- syntax/python.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/syntax/python.vim b/syntax/python.vim index 2860007..49e0b27 100644 --- a/syntax/python.vim +++ b/syntax/python.vim @@ -68,13 +68,19 @@ syn keyword pythonStatement as assert break continue del global 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 (new in Python 2.4) " A dot must be allowed because of @MyClass.myfunc decorators. syn match pythonDecorator "@" display contained -- 2.45.2