mirror of
https://github.com/neovim/neovim.git
synced 2026-01-29 00:27:15 +10:00
`type` became a soft keyword in Python 3.12. In that form, it is a
statement that declares a type alias:
# type_stmt ::= 'type' identifier [type_params] "=" expression
type Point = tuple[float, float]
To implement support for this, this change does three things:
1. adds a `pythonType` group (linked to `Type`)
2. matches `type` followed by an identifier as `pythonStatement`
3. continues to match `type` in other forms as `pythonBuiltin`
Ref:
- https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
- https://docs.python.org/3/reference/simple_stmts.html#the-type-statement
closes: vim/vim#18090
99964e2ea7
Co-authored-by: Jon Parise <jon@indelible.org>
17 KiB
17 KiB