]> git.ipfire.org Git - thirdparty/vim.git/commit
runtime(python): highlight ellipsis literals
authorJon Parise <jon@indelible.org>
Mon, 8 Sep 2025 20:29:53 +0000 (16:29 -0400)
committerChristian Brabandt <cb@256bit.org>
Mon, 8 Sep 2025 20:29:53 +0000 (16:29 -0400)
commit77cfc49060a50daefd1675b8a1dece0e6e943384
tree0a30c9f74becff61195eb22ed28ab70d41e21745
parentd7d6a6f05a536b443188ff95a45bbd46485f11fb
runtime(python): highlight ellipsis literals

The ellipsis literal (`...`) can be used in multiple contexts:

- Placeholders:     `class Foo: ...`
- Containers:       `Tuple[int, ...]`
- Assignments:      `x = ...`

This is a trickier pattern to match because we can't rely on keyword
boundaries, so we instead look for exactly three dots (`...`).

This does mean that we will match the `...` portion of `x...x`, which
isn't valid Python syntax, but I think that's an acceptable trade-off
that avoids making this pattern much more complex.

Reference:
- https://docs.python.org/3/library/constants.html#Ellipsis

closes: #18107

Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/python.vim
runtime/syntax/testdir/dumps/python_ellipsis_00.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/python_ellipsis_01.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/python_ellipsis_02.dump [new file with mode: 0644]
runtime/syntax/testdir/input/python_ellipsis.py [new file with mode: 0644]