times: Node
-class Subscript(Dataclass):
+class SubscriptExpr(Dataclass):
index: Node
subject: Node = Node()
-class RangeSubscript(Dataclass):
+class RangeSubscriptExpr(Dataclass):
start: Node
end: Node = Node()
subject: Node = Node()
else:
attribute_or_subscript = (
pc_ast.Attribute,
- pc_ast.Subscript,
- pc_ast.RangeSubscript,
+ pc_ast.SubscriptExpr,
+ pc_ast.RangeSubscriptExpr,
)
if isinstance(p[2], attribute_or_subscript):
node = p[2]
else:
attribute_or_subscript = (
pc_ast.Attribute,
- pc_ast.Subscript,
- pc_ast.RangeSubscript,
+ pc_ast.SubscriptExpr,
+ pc_ast.RangeSubscriptExpr,
)
if isinstance(p[2], attribute_or_subscript):
node = p[2]
| test
"""
if len(p) == 4:
- p[0] = pc_ast.RangeSubscript(start=p[1], end=p[3])
+ p[0] = pc_ast.RangeSubscriptExpr(start=p[1], end=p[3])
else:
- p[0] = pc_ast.Subscript(index=p[1])
+ p[0] = pc_ast.SubscriptExpr(index=p[1])
# testlist: test (',' test)* [',']
# Contains shift/reduce error
yield node
lvalue = str(self[node.lvalue])
if (isinstance(node.lvalue, (pc_ast.GPR, pc_ast.FPR)) or
- (isinstance(node.lvalue, (pc_ast.Subscript, pc_ast.RangeSubscript)) and
+ (isinstance(node.lvalue, (pc_ast.SubscriptExpr, pc_ast.RangeSubscriptExpr)) and
isinstance(node.lvalue.subject, (pc_ast.GPR, pc_ast.FPR)))):
lvalue = lvalue.replace("(", "").replace(")", "")
rvalue = str(self[node.rvalue])
stmt = mapping[node.__class__]
self[node].emit(stmt=stmt)
- @pc_util.Hook(pc_ast.Subscript)
- def Subscript(self, node):
+ @pc_util.Hook(pc_ast.SubscriptExpr)
+ def SubscriptExpr(self, node):
yield node
stmt = "".join([
str(self[node.subject]),
])
self[node].emit(stmt=stmt)
- @pc_util.Hook(pc_ast.RangeSubscript)
- def RangeSubscript(self, node):
+ @pc_util.Hook(pc_ast.RangeSubscriptExpr)
+ def RangeSubscriptExpr(self, node):
yield node
stmt = "".join([
str(self[node.subject]),