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>
This commit is contained in:
Jon Parise
2025-09-08 16:29:53 -04:00
committed by Christian Brabandt
parent d7d6a6f05a
commit 77cfc49060
5 changed files with 110 additions and 2 deletions

View File

@ -0,0 +1,20 @@
| +0&#ffffff0@74
|#+0#0000e05&| |D|o|c|t|e|s|t|s| +0#0000000&@64
|"+0#e000002&@2|A| |d|o|c|t|e|s|t| +0#0000000&@62
@75
|>+0#e000e06&@2| |c+0#af5f00255&|l|a|s@1| +0#e000e06&|A+0#00e0003&|:+0#e000e06&| +0#0000000&@62
>.+0#e000e06&@2| @4|d+0#af5f00255&|e|f| +0#e000e06&|_+0#00e0e07&@1|i|n|i|t|_@1|(+0#0000000&|s+0#00e0e07&|e|l|f|)+0#0000000&|:+0#e000e06&| +0#0000000&@47
|.+0#e000e06&@2| @12|.+0#00e0e07&@2| +0#0000000&@55
|>+0#e000e06&@2| |c+0#af5f00255&|l|a|s@1| +0#e000e06&|B+0#00e0003&|:+0#e000e06&| |.+0#00e0e07&@2| +0#0000000&@58
|>+0#e000e06&@2| |x| |=| |.+0#00e0e07&@2| +0#0000000&@63
|>+0#e000e06&@2| |r+0#af5f00255&|a|i|s|e| +0#e000e06&|V+0#00e0003&|a|l|u|e|E|r@1|o|r|(+0#0000000&|'+0#e000002&|m|u|l|t|i|\+0#e000e06&|n| +0#e000002&@3|l|i|n|e|\+0#e000e06&|n|d+0#e000002&|e|t|a|i|l|'|)+0#0000000&| @27
|T+0#e000e06&|r|a|c|e|b|a|c|k| |(|m|o|s|t| |r|e|c|e|n|t| |c|a|l@1| |l|a|s|t|)|:| +0#0000000&@40
| +0#e000e06&@3|.+0#00e0e07&@2| +0#0000000&@67
|V+0#00e0003&|a|l|u|e|E|r@1|o|r|:+0#e000e06&| |m|u|l|t|i| +0#0000000&@57
| +0#e000e06&@3|l|i|n|e| +0#0000000&@66
|d+0#e000e06&|e|t|a|i|l| +0#0000000&@68
|>+0#e000e06&@2| |p+0#00e0e07&|r|i|n|t|(+0#e000e06&|l+0#00e0e07&|i|s|t|(+0#e000e06&|r+0#00e0e07&|a|n|g|e|(+0#0000000&|2+0#e000002&|0|)+0#0000000&|)+0#e000e06&@1| @1|#+0#0000e05&| |d|o|c|t|e|s|t|:| |+|E|L@1|I|P|S|I|S| +0#0000000&@26
|[+0#e000e06&|0|,| |1|,| |.+0#00e0e07&@2|,+0#e000e06&| |1|8|,| |1|9|]| +0#0000000&@55
|>+0#e000e06&@2| |e+0#00e0e07&|x|e|c|(+0#0000000&|s|)| +0#e000e06&@1|#+0#0000e05&|d|o|c|t|e|s|t|:| |+|E|L@1|I|P|S|I|S| +0#0000000&@42
|-+0#e000e06&|3|.|2|1|7|1|6|0|3|4|2|7|2|e|-|0|.+0#00e0e07&@2|7+0#e000e06&| +0#0000000&@53
@57|1|9|,|1| @9|5|4|%|