Re: Update request for Python syntax file

Benno Schulenberg <[email protected]> Tue, 3 Feb 2026 16:44:23 +0100
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
Op 02-02-2026 om 17:29 schreef Stanislaw Majewski:
> I've notice a time ago that nano is lacking a syntax
> highlight of match statment in python files.
> That statment was introduced in version 3.10.

It would have been nicer if you had provided a URL to the
relevant documentation.  For example:

https://docs.python.org/3/whatsnew/3.10.html#pep-634-structural-pattern-matching

> I wounder if anyone else is experiencing same issue
> and if it might be something to be updated.

Please try the attached patch.  Is this good enough?

[When answering, please reply only to the list.]


Benno
0001-syntax-python-colorize-also-the-match-and-case-keywo.patch (text/x-patch, 1.2 KB)
From bf194dae5decbe95484fa8087144640ebdaa9b3a Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email protected]>
Date: Tue, 3 Feb 2026 16:37:37 +0100
Subject: [PATCH] syntax: python: colorize also the `match` and `case` keywords

These keywords were introduced in Python-3.10:
  https://docs.python.org/3/whatsnew/3.10.html#pep-634-structural-pattern-matching

Reported-by: Stanislaw Majewski <[email protected]>
---
 syntax/python.nanorc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/syntax/python.nanorc b/syntax/python.nanorc
index e5c84766..b8740194 100644
--- a/syntax/python.nanorc
+++ b/syntax/python.nanorc
@@ -11,9 +11,9 @@ linter pyflakes
 # Function definitions.
 color brightblue "def [[:alnum:]_]+"
 # Keywords.
-color brightcyan "\<(and|as|assert|async|await|break|class|continue)\>"
+color brightcyan "\<(and|as|assert|async|await|break|case|class|continue)\>"
 color brightcyan "\<(def|del|elif|else|except|finally|for|from)\>"
-color brightcyan "\<(global|if|import|in|is|lambda|nonlocal|not|or)\>"
+color brightcyan "\<(global|if|import|in|is|match|lambda|nonlocal|not|or)\>"
 color brightcyan "\<(pass|raise|return|try|while|with|yield)\>"
 
 # These two are keywords in Python 2, but functions in Python 3,
-- 
2.51.2
OpenPGP_signature.asc (application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmmCF9cFAwAAAAAACgkQUUu+Lrjhlh/+
nRAAviH1/4dPWSdA7x4h7cZjHOoX9iAuW8hd9XCQvxYEG3P1ZSMPH/r0kAGEUrC+rJPw5r3aGNVo
M/cOmkxmS6iCYuxKvYrUASSM0Wv+vrcH25SOakAQifwWKZCO+HfdLzRuitYHABqXzea6MVTDltBZ
AN4WBYuOMxgDUbSruP8qX7OYSEUmtq3LRz7koQwne+mvWz+EFw+oaJN8NstwQdiCfMHpU66HJ0M7
qK4VowrY6KsY1Nx2HMYkou0DUFycbNQ2zOemwsAPcFi2rDB/Qgq7iwR40EYEfZ/wDVeNFP5z2/TP
V3HEbUCN739NQPvKgd3vhx9hT9AFhLsWE0clGHPX4wC1xlPGYqD+6O0ttbIrgZzJVJC7wLitu4dw
sbCh6/B1zD5skyIm9Iqq8c1fQs+GFUemAZ0WTx5cRJ00n3bFajGG5jY3uktpIwC9BE3yYzsB3N4K
V8EByAxdSVRQxIgPBmdHlq1GYHTcSmpuHXgVWfLUhVgObGgG2UDdy9rHwO2iYtvJJDwG/itD4sBo
I6b5wE8qnpa1sbpFda0/XoN27EP3g5DFUhANqK9Dkaqdo8orD6fdSjvLk4aUX4HG8DE8jxDdrpyc
HK/RcYXtBStfoOHuoxGPQQu7GW2sD+h5dHOdSyg2eVGFoDeEdn/IsBD+j3gADLJ40v8nQrjPDZh0
yYk=
=H914
-----END PGP SIGNATURE-----