Skip to content

Commit

Permalink
Basic match support
Browse files Browse the repository at this point in the history
  • Loading branch information
granvillebarnett committed Oct 15, 2021
1 parent 2cc00ba commit 988efe9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
30 changes: 30 additions & 0 deletions match.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/syntax/python.vim b/syntax/python.vim
index 2524aba..3d49f51 100644
--- a/syntax/python.vim
+++ b/syntax/python.vim
@@ -81,6 +81,7 @@ if s:Enabled('g:python_highlight_class_vars')
endif
syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else
+syn keyword pythonMatch match case
syn keyword pythonException try except finally
" The standard pyrex.vim unconditionally removes the pythonInclude group, so
" we provide a dummy group here to avoid crashing pyrex.vim.
@@ -105,7 +106,7 @@ else
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
syn match pythonStatement '\<async\s\+with\>'
syn match pythonStatement '\<async\s\+for\>'
- 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
+ syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonMatch,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonFString,pythonRawString,pythonRawFString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType,pythonClassVar
endif


@@ -434,6 +435,7 @@ if v:version >= 508 || !exists('did_python_syn_inits')
HiLink pythonFunction Function
HiLink pythonFunctionCall Function
HiLink pythonConditional Conditional
+ HiLink pythonMatch Conditional
HiLink pythonRepeat Repeat
HiLink pythonException Exception
HiLink pythonOperator Operator

4 changes: 3 additions & 1 deletion syntax/python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ if s:Enabled('g:python_highlight_class_vars')
endif
syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else
syn keyword pythonMatch match case
syn keyword pythonException try except finally
" The standard pyrex.vim unconditionally removes the pythonInclude group, so
" we provide a dummy group here to avoid crashing pyrex.vim.
Expand All @@ -105,7 +106,7 @@ else
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
syn match pythonStatement '\<async\s\+with\>'
syn match pythonStatement '\<async\s\+for\>'
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
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonMatch,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonFString,pythonRawString,pythonRawFString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType,pythonClassVar
endif


Expand Down Expand Up @@ -434,6 +435,7 @@ if v:version >= 508 || !exists('did_python_syn_inits')
HiLink pythonFunction Function
HiLink pythonFunctionCall Function
HiLink pythonConditional Conditional
HiLink pythonMatch Conditional
HiLink pythonRepeat Repeat
HiLink pythonException Exception
HiLink pythonOperator Operator
Expand Down

0 comments on commit 988efe9

Please sign in to comment.