mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-30 23:27:39 +00:00
Add parsing of type alias statements i.e. the type
keyword (#97)
Extends #95 Closes #82 Adds parsing of new `type` soft keyword for defining type aliases. Supports type alias statements as defined in PEP 695 e.g. ```python # A non-generic type alias type IntOrStr = int | str # A generic type alias type ListOrSet[T] = list[T] | set[T] # A type alias that includes a forward reference type AnimalOrVegetable = Animal | "Vegetable" # A generic self-referential type alias type RecursiveList[T] = T | list[RecursiveList[T]] ``` All type parameter kinds are supported as in #95. Builds on soft keyword abstractions introduced in https://github.com/RustPython/RustPython/pull/4519
This commit is contained in:
parent
6980037ad9
commit
704eb40108
9 changed files with 20667 additions and 18194 deletions
|
@ -154,6 +154,7 @@ fn gen_phf(out_dir: &Path) {
|
|||
.entry("raise", "Tok::Raise")
|
||||
.entry("return", "Tok::Return")
|
||||
.entry("try", "Tok::Try")
|
||||
.entry("type", "Tok::Type")
|
||||
.entry("while", "Tok::While")
|
||||
.entry("with", "Tok::With")
|
||||
.entry("yield", "Tok::Yield")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue