mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-03 10:23:22 +00:00
Rename unconventional nodes
This commit is contained in:
parent
edcfcb4a74
commit
6b038b867a
18 changed files with 1057 additions and 1048 deletions
|
@ -31,6 +31,14 @@ BUILTIN_INT_NAMES = {
|
|||
"conversion": "ConversionFlag",
|
||||
}
|
||||
|
||||
RENAME_MAP = {
|
||||
"cmpop": "cmp_op",
|
||||
"unaryop": "unary_op",
|
||||
"boolop": "bool_op",
|
||||
"excepthandler": "except_handler",
|
||||
"withitem": "with_item",
|
||||
}
|
||||
|
||||
RUST_KEYWORDS = {
|
||||
"if",
|
||||
"while",
|
||||
|
@ -124,6 +132,7 @@ def rust_type_name(name):
|
|||
|
||||
This function special cases the default types provided by asdl.
|
||||
"""
|
||||
name = RENAME_MAP.get(name, name)
|
||||
if name in asdl.builtin_types:
|
||||
builtin = BUILTIN_TYPE_NAMES[name]
|
||||
return builtin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue