runtime(python): update rendering of Unicode named literals in syntax script
Commit: https://github.com/vim/vim/commit/6f85cec4fbc1d1261c67a339a11792dd8f2efd14 Author: Zvezdan Petkovic <zpetko...@acm.org> Date: Sun Jul 13 08:23:24 2025 +0200 runtime(python): update rendering of Unicode named literals in syntax script This change: * enforces that the alias starts with a letter * allows the other words in an alias to be separated by either a space or a hyphen, but not both or double separators * allows only a letter after space, possibly followed by letters or digits * allows both letters and digits after a hyphen Tested with: a = '\N{Cyrillic Small Letter Zhe} is pronounced as zh in pleasure' b = '\N{NO-BREAK SPACE} is needed here' # ... other tests here r = '\N{HENTAIGANA LETTER E-1} is a Japanese hiragana letter archaic ye' s = '\N{CUNEIFORM SIGN NU11 TENU} is a correction alias' t = '\N{RECYCLING SYMBOL FOR TYPE-1 PLASTICS} base shape is a triangle' print(a) print(b) print(r) print(s) print(t) The tests confirm the behavior and are selected from real Unicode tables/aliases to check these combinations based on the specification. fixes: #17323 closes: #17735 Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 7aa82f1b9..68036f590 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -160,7 +160,8 @@ syn match pythonEscape "\\o\{1,3}" contained syn match pythonEscape "\x\x\{2}" contained syn match pythonEscape "\%(\u\x\{4}\|\U\x\{8}\)" contained " Python allows case-insensitive Unicode IDs: http://www.unicode.org/charts/ -syn match pythonEscape "\N{ \+\%(\s \+\)*}" contained +" The specification: https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-4/#G135165 +syn match pythonEscape "\N{ \+\%(\%(\s \+[[:alnum:]]*\)\|\%(-[[:alnum:]]\+\)\)*}" contained syn match pythonEscape "\$" " It is very important to understand all details before changing the -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1uaqDv-002bDm-KW%40256bit.org.