]> git.ipfire.org Git - thirdparty/vim.git/commit
runtime(python): update rendering of Unicode named literals in syntax script
authorZvezdan Petkovic <zpetkovic@acm.org>
Sun, 13 Jul 2025 06:23:24 +0000 (08:23 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 13 Jul 2025 06:23:24 +0000 (08:23 +0200)
commit6f85cec4fbc1d1261c67a339a11792dd8f2efd14
tree0ef4298966ae473e5a96f2677954e74d2af65b2e
parent68ee1cf7de36bdd6e642807c8beda751112aaab8
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 <cb@256bit.org>
runtime/syntax/python.vim