oppc: rename Assign classes
authorDmitry Selyutin <ghostmansd@gmail.com>
Mon, 8 Jan 2024 20:26:32 +0000 (23:26 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 16 Jan 2024 19:10:07 +0000 (22:10 +0300)
src/openpower/oppc/pc_ast.py
src/openpower/oppc/pc_parser.py
src/openpower/oppc/pc_util.py

index 5a8d0a06e56a3557a8b78fefb418503f9c98d72b..d139d2dbb9e10c0d971349a14ceba1178ee72a6c 100644 (file)
@@ -245,12 +245,12 @@ class AssignIEAOp(Token):
     pass
 
 
-class Assign(Dataclass):
+class AssignExpr(Dataclass):
     lvalue: Node
     rvalue: Node
 
 
-class AssignIEA(Assign):
+class AssignIEAExpr(AssignExpr):
     lvalue: Node
     rvalue: Node
 
index 596830ed3b950c11366e72f16ba69ce07b067ac6..03adc6356b0d467fc3d6a776cf1a904b99e00d0c 100644 (file)
@@ -207,9 +207,9 @@ class Parser:
         else:
             (lvalue, rvalue) = (p[1], p[3])
             if isinstance(p[2], pc_ast.AssignOp):
-                cls = pc_ast.Assign
+                cls = pc_ast.AssignExpr
             else:
-                cls = pc_ast.AssignIEA
+                cls = pc_ast.AssignIEAExpr
             if (isinstance(lvalue, pc_ast.Symbol) and
                     (str(lvalue) in self.__class__.REGS)):
                 lvalue = self.__class__.REGS[str(lvalue)](lvalue)
index e3e184edc7284dba6fa64fc3069e4ddbcc11f446..76058ecb62ebffaa54862e825828bfaf46971469 100644 (file)
@@ -88,11 +88,11 @@ class PseudocodeVisitor(mdis.visitor.ContextVisitor):
         stmt = f"{node.name}({args})"
         self[node].emit(stmt=stmt)
 
-    @Hook(pc_ast.Assign, pc_ast.AssignIEA)
-    def Assign(self, node):
+    @Hook(pc_ast.AssignExpr, pc_ast.AssignIEAExpr)
+    def AssignExpr(self, node):
         mapping = {
-            pc_ast.Assign: "<-",
-            pc_ast.AssignIEA: "<-iea",
+            pc_ast.AssignExpr: "<-",
+            pc_ast.AssignIEAExpr: "<-iea",
         }
         yield node
         lvalue = str(self[node.lvalue])