unmap_dict -> dict_doublestar ...

This matches Python's AST (Dict) better. Variations or specializations
of an AST name, e.g. "unmap" should come at the end, not the beginning.
This commit is contained in:
rocky
2021-12-23 22:24:45 -05:00
parent 30aad42aae
commit 23551ea70f
6 changed files with 13 additions and 14 deletions

View File

@@ -775,7 +775,7 @@ class Python3Parser(PythonParser):
# FIXME: Use the attr
# so this doesn't run into exponential parsing time.
if opname.startswith("BUILD_MAP_UNPACK"):
# FIXME: start here. The LHS should be unmap_dict, not dict.
# FIXME: start here. The LHS should be dict_unmap, not dict.
# FIXME: really we need a combination of dict_entry-like things.
# It just so happens the most common case is not to mix
# dictionary comphensions with dictionary, elements
@@ -786,8 +786,8 @@ class Python3Parser(PythonParser):
)
self.addRule(rule, nop_func)
rule = """
expr ::= unmap_dict
unmap_dict ::= %s%s
expr ::= dict_unmap
dict_unmap ::= %s%s
""" % (
"expr " * token.attr,
opname,

View File

@@ -201,8 +201,8 @@ class Python35Parser(Python34Parser):
self.addRule(rules_str, nop_func)
elif opname == 'BUILD_MAP_UNPACK':
self.addRule("""
expr ::= unmap_dict
unmap_dict ::= dict_comp BUILD_MAP_UNPACK
expr ::= dict_unmap
dict_unmap ::= dict_comp BUILD_MAP_UNPACK
""", nop_func)
elif opname == 'SETUP_WITH':

View File

@@ -336,8 +336,8 @@ class Python37BaseParser(PythonParser):
if opname == "BUILD_MAP_UNPACK":
self.addRule(
"""
expr ::= unmap_dict
unmap_dict ::= dict_comp BUILD_MAP_UNPACK
expr ::= dict_unmap
dict_unmap ::= dict_comp BUILD_MAP_UNPACK
""",
nop_func,
)
@@ -367,7 +367,7 @@ class Python37BaseParser(PythonParser):
# FIXME: Use the attr
# so this doesn't run into exponential parsing time.
if opname.startswith("BUILD_MAP_UNPACK"):
# FIXME: start here. The LHS should be unmap_dict, not dict.
# FIXME: start here. The LHS should be dict_unmap, not dict.
# FIXME: really we need a combination of dict_entry-like things.
# It just so happens the most common case is not to mix
# dictionary comphensions with dictionary, elements
@@ -375,8 +375,8 @@ class Python37BaseParser(PythonParser):
rule = "dict ::= %s%s" % ("dict_comp " * token.attr, opname)
self.addRule(rule, nop_func)
rule = """
expr ::= unmap_dict
unmap_dict ::= %s%s
expr ::= dict_unmap
dict_unmap ::= %s%s
""" % (
"expr " * token.attr,
opname,